I have a simple jquery code:
$(function(){
$('#note_pag a').click(function(){
alert('click');
return false;
});
});
and this is the html code:
<div id="note_pag">
<ul>
<li><a href="1">1</a></li>
<li><a href="2">2</a></li>
<li><a href="3">3</a></li>
<li><a href="4">4</a></li>
</ul>
</div>
my question is: how can i get the href of the link clicked from the user?
Thanks
Within the event handler,
thisis a reference to the element clicked. You can then use that DOM element to build a jQuery selection, and then use theattrfunction to get the value of thehrefattribute: