Get or set #hash value in URL using Javascript or jQuery, we can
change URL without refreshing page using Javascript or jQuery by
changing #hash value, like below:
- example.com/page.html#example
- example.com/page.html#example-page
Javascript or jQuery
// get #hash value
var hashValue = window.location.hash
// set #hash value, it will change URL to example.com/page.html#example-page
window.location.hash = "example-page"
If you have question don't forget to ask.
Thank you for going through