I\'m trying to get the hash value after a link was clicked. Any ideas?
e.g.
The Link
index.html#needThis
This is my result:
Try this,
$('#myselector').on('click', 'a', function(){ var url = $(this).attr('href') //get url var arr = url.split('#'); alert(arr[0]); //URL without hash # var hash = arr[1]; console.log(hash); })