How do I get get the value after # in the link when that link is clicked?
$(".myLink").click(function(){
???
}
<a href="myPage.php?a=asdasdasd#value" class="myLink">link</a>
$('a.myLink').click(function() {
alert(this.hash);
return false;
});
$(".myLink").click(function(evt){
var arr = $(this).attr('href').split('#');
alert(arr[1]);
evt.preventDefault();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With