html
<ul>
<li><a href="#" >Link</a>
<ul>
<li><a href="#" >Link</a></li>
<li><a href="#" >Link</a></li>
</ul>
</li>
</ul>
jQuery
$(function(){
$('ul').click(function(event){
alert(event.target);
return false;
});
});
Can someone punch me to the head and tell me WHY on earth event.target
is giving me a url
when I click on anchors? I'm expecting it to give me [object HTMLAElement]
. Just like [object HTMLLIElement]
when you click li
element. sample fiddle.
I have read this link, jquery-anchor-click-this-e-target-returns-url, but doesn't seem to answer my question.