Reputation: 51
I have an anchor text link that contains information that I need to parse:
<a href="javascript:parselink(this)">
<div class="calendar">
<div class='day'>8</div>
<div class="number">75</div>
</div>
</a>
<script>
function parselink(link){
alert(link.innerHtml);
}
</script>
However, I am not able to get the anchor text's innerHhtml.
Upvotes: 1
Views: 41
Reputation: 207511
You have a typo
innerHtml !== innerHTML
And use onclick, not href to trigger the event
function parselink(link){
alert(link.innerHTML);
}
<a href="#" onclick="parselink(this); return false;">
<div class="calendar">
<div class='day'>8</div>
<div class="number">75</div>
</div>
</a>
Upvotes: 2