Shubham Jha Shubham Jha - 1 year ago 106
Javascript Question

Grab #id from the URL in jQuery

I have a URL like this

. I want to fetch the id from the URL end and store it in a variable container to check in if else statement in jquery. How can I do so?

Answer Source

Window is a global javascript object,

You use window.location.hash to get the hash value, it will return null if there is no hash present.

var hashValue=window.location.hash;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download