Home>> JQuery >>How to access anchor attribute text/href on click using jQuery?
<a class="kkLink" href="link_of_file">
link_of_file
</a>
For href:
$(function(){
$('.kkLink').click(function(){
alert($(this).attr('href'));
// or alert($(this).hash();
});
});
For Text:
$(function(){
$('.kkLink').click(function(){
alert($(this).text());
});
});
![]()
Hello! I'm Krishan Kumar Singh author, .NET Framework and have more than 6+ years of hand over Microsoft .NET technologies.
|