jquery check if hash exists code example
Example 1: Javascript check for hash in URL
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
Example 2: javascript hashtag url
var hash = window.location.hash;
if (hash) {
// Fragment exists
hash = hash.substring(1);
console.log(hash);
} else {
// Fragment doesn't exist
}