Posted on June 12, 2011 by Grace Beltran
Total Posts: 1 | Join date: 06-01-11
http://www.domain.com/#link"
Using window.location.hash returns #link
How do I make a link that would get the #link before it's posted on the URL?
Tags: There are no tags for this entry.
Posted on on June 12, 2011 at 10:17am
by Michael Rosario
<a href="#link" class="MyLINK">The name of the link</a>
$('.MyLINK').click(function() {
var d = $(this).attr('href').replace('#','');
alert(d); //gets #link
return false;
OR
$('.MyLINK').click(function() {
var d = this.hash;
alert(d); //gets #link from the URL
return false;
});
Posted on on August 26, 2011 at 8:03pm
by asthmanet
Posted on on October 2, 2011 at 6:53am
by Leatrix
Posted on on January 31, 2013 at 4:08pm
by Michael Rosario
$(this).attr('href').substring($(this).attr('href').indexOf('#'));