JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<a href="#" id="link1">Do it</a>
</p>
<p>
<a href="#" id="link2">Do it again</a>
</p>
<div id="output"></div>
JavaScript
var custom_event = 'my-event';
$('body').on(custom_event, function(e, arg) {
$('#output').append($('<p>' +arg+'</p>'));
});
$('a').click(function(e) {
$('body').trigger(custom_event, 'clicked ' + $(this).attr('id'));
e.preventDefault();
});