Anchor hash attribute
Definition and usage
hash
Property setting or return href attribute value Anchor part.
The anchor part is the part after the hash (#) in the URL.
Note:Do not include the hash (#) when this attribute is used to set the anchor part.
See also:
JavaScript Reference Manual:location.hash attribute
Example
Example 1
Return the anchor part of the link:
var x = document.getElementById("myAnchor").hash;
Example 2
Change the anchor part of the link:
document.getElementById("myAnchor").hash = "newhashvalue";
Syntax
Return hash attribute:
anchorObject.hash
Tayin hash ɗanar:
anchorObject.hash = anchorname
Kudade ɗanar
Kudade ɗanar | Tsammanin ɗanar |
---|---|
anchorname | Dade URL ɗanar. |
Tsare ɗanar
Kudade ɗanar: | Kudade ɗanar, yana nufin ɗanar URL, wanda ya ɗauki kashi kan hanyar, ya ɗauki ɗanar (#). |
---|
Kudade ɗanar
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Tsaro ɗanar | Tsaro ɗanar | Tsaro ɗanar | Tsaro ɗanar | Tsaro ɗanar |