JSFiddle - React, Tailwind, and code Playground

HTML

<a href="javascript:alert('This works!');" id="myHrefLink">My HREF Link</a>

JavaScript

try{
  document.getElementById("myHrefLink").click(); //this should click on the link when the page loads
}catch(e){
  alert("This does not work!!!\nERROR:\n" + e)
}