Advertisement
Home Open Editor ❯

HTML onhashchange Attribute

Example

<body onhashchange="myFunction()">

Try this code ❯

Meaning

The onhashchange attribute fires when the URL’s hash identifier value changes.

Changing this value is commonly performed in Ajax applications to indicate a state change and support browser back-button activity.


Standard Syntax

<element onhashchange="script">


Applies to:

The onhashchange attribute can be used on the following element:

Element Attribute
<body> onhashchange

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on onhashchange
Home Open Editor ❯
Advertisement