MDN self-hosted library · e01.org

MathMLAnchorElement: hash property

MathML

Open notebook · 2 cells web-api-instance-property upstream source

MathML

The hash property of the MathMLAnchorElement interface is a string containing a "#" followed by the fragment identifier of the <a> element's href. If the URL does not have a fragment identifier, this property contains an empty string, "".

See URL.hash for more information.

Value

A string.

Examples

Basic usage

Given this MathML:

<math>
  <a id="myAnchor" href="https://example.com#examples">...</a>
</math>

you can get the hash of the anchor like this:

const mathAnchor = document.getElementById("myAnchor");
mathAnchor.hash; // '#examples'

Specifications

Browser compatibility

See also

  • The MathML <a> element