JSFiddle - React, Tailwind, and code Playground

by zequez

HTML

<input id="location" size="50"/>
<br/>
<a href="#something">#something</a>
<br/>
<a href="#somethingElse">#somethingElse</a>
<br/>
<a href="#">#</a>
<br/>
<a href="#" id="remove">Remove hash</a>

JavaScript

var l = document.getElementById('location');
setInterval(function() {
   l.value = window.location.href;
}, 10);

var a = document.getElementById('remove');
a.addEvent('click', function(e) {
    e.preventDefault();
    window.history.pushState('', '', window.location.pathname);
});

window.addEvent('hashchange', function() {
    alert('Hash changed! ' + document.location.hash); 
});