JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" id="foo">hello</a>
<script>
$( "#foo" ).on( "click", function() {
  alert( "hello world" );
});
$( "#foo" ).trigger( "click" );
</script>