JSFiddle - React, Tailwind, and code Playground

by mblase75

HTML

<a href="#hash1">function A</a>
<a href="#hash2">function B</a>
<br>
<a href="javascript:history.go(-1)">go back</a>

JavaScript

$(window).on('hashchange',function() {
    var hash = location.hash.substring(1); // strip the leading # symbol
    alert(hash);
});