JSFiddle - React, Tailwind, and code Playground

by lun471k

HTML

<div id="one">
    <a href="#two">Link to two</a>
</div>
<div id="#two">
    Link to me
</div>

JavaScript

window.onload = function(){
    var a  = document.getElementsByTagName('a');
    for (var elem in a)
    {
        if(a[elem].nodeType ==1)
        {
            a[elem].addEventListener("click",function(e){window.location.href = this.getAttribute('href');alert(window.location.href);});
            /*
            console.log(window.location.href);*/
        }
    }
}