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:
More "Try it Yourself" examples below.
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 (#).
Property | |||||
---|---|---|---|---|---|
hash | Yes | Yes | Yes | Yes | Yes |
Return the hash property:
Set the hash property:
Value | Type | Description |
---|---|---|
anchorname | String | Specifies the anchor part of a URL |
Return Value: | A String, representing the anchor part of the URL, including the hash sign (#) |
---|