HTML onhashchange event Attribute

❮ HTML Event Attributes


<body onhashchange="myFunction()">


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">

Browser Support


Attribute Values

Value Description
script Specifies the script to be run on onhashchange

Technical Details

Supported HTML elements:

❮ HTML Event Attributes