Location hash Property
Return the anchor part 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 part of a URL, including the hash sign (#).
Note: When this property is used to set the anchor part, 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 part of a URL|
|String||The anchor part of the URL, including the hash sign (#)|
How to set the anchor part of a URL.
Thank You For Helping Us!
Your message has been sent to W3Schools.