get hash js

JavaScript
if (location.href.indexOf("#") != -1) {
    //current url has a #hash in it
}location.hash
Source

Also in JavaScript: