Location hash Property
Return the anchor portion of a URL. Assume that the current URL is http://www.example.com/test.htm#part2:
The result of x will be:
Definition and Usage
The hash property sets or returns the anchor portion of a URL, including the hash sign (#).
Tip: When you set the anchor portion, do not include the hash sign.
The hash property is supported in all major browsers.
Return the hash property:
Set the hash property:
|anchorname||String||Specifies the anchor portion of the URL|
|String||The anchor portion of a URL, including the hash sign (#). If there is no hash sign, an empty string is returned|
How to set the anchor portion of a URL.
Thank You For Helping Us!
Your message has been sent to W3Schools.