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>
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();
});
$(".myLink").click(function(){
var link=$(".myLink").attr('href');
pos=link.indexOf("#", 0);
value=link.substring(pos,link.length);
}
var href = $(this).attr("href");
var hash = href.indexOf("#") > 0
? href.substring(href.indexOf("#") + 1)
: "";