get page navigation (#id) value from the url using javascript code example
Example 1: Javascript check for hash in URL
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
Example 2: get hash js
location.hash
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
location.hash