JSFiddle - React, Tailwind, and code Playground
HTML
<div id="element">Testing this element</div>
<a href="#" id="helpMode">CLICK</a>
<a href="#" id="helpModeOff">CLICK 2</a>
CSS
* { padding: 25px; }
.toggleThing { background:#000; color:#fff; }
JavaScript
var originalEvent = '';
$('#element').on('yourCustomEvent', function (e) {
// do stuff
alert(originalEvent);
$(this).toggleClass('toggleThing');
//test for helpMode or helpModeOff here now...
});
$("#helpMode").on('click', function (e) {
originalEvent = e.srcElement.id;
$("#element").trigger('yourCustomEvent');
});
//Later in the code
$("#helpModeOff").on('click', function (e) {
originalEvent = e.srcElement.id;
$("#element").trigger('yourCustomEvent');
});