Assume that the current URL is – http://www.codexworld.com/index.php#VideoTutorial
Get value with hashtag (#): (#VideoTutorial)
var hash = location.hash;
Get value after hashtag (#): (VideoTutorial)
var hash = location.hash.substr(1);
Get hash value from href: (#VideoTutorial)
this.hash returns the hash value from href attributes of an anchor tag.
<a href="http://www.codexworld.com/index.php#VideoTutorial" onclick="alert(this.hash)">Get Hash</a>