Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created January 23, 2012 15:57
Show Gist options
  • Save gavinblair/1663956 to your computer and use it in GitHub Desktop.
Save gavinblair/1663956 to your computer and use it in GitHub Desktop.
Get hash of an anchor
$("<a href='http://www.google.com#hello'>gavin</a>")[0].hash //returns "#hello"
$("#mylink")[0].hash //jquery selector
document.getElementById("mylink").hash //no jquery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment