HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The onhashchange attribute fires when there has been changes to the anchor part (begins with a '#' symbol) of the current URL."
The onhashchange attribute fires when there has been changes to the anchor part (begins with a '#' symbol) of the current URL.
An example of what an anchor part actually is: Assume that the current URL is
http://www.example.com/test.htm#part2 - The anchor part of this URL would be
#part2.
To invoke this event, you can:
The onhashchange attribute is part of the Event Attributes, and can be used on the following element:
Elements | Event |
---|---|
<body> | onhashchange |
Execute a JavaScript when the anchor part has been changed:
<body onhashchange="myFunction()">
The numbers in the table specify the first browser version that fully supports the event attribute.
Event Attribute | |||||
---|---|---|---|---|---|
onhashchange | 5.0 | 8.0 | 3.6 | 5.0 | 10.6 |