JSFiddle - React, Tailwind, and code Playground
HTML
<div id="testDiv">
<button class="testClass">Test Button</button>
</div>
JavaScript
var subscribeClickEvent = function() {$("#testDiv").one("click", ".testClass", clickHandler);};
function clickHandler() {
//... perform the tasks
alert("you clicked the button");
//... subscribe the click handler again when the processing of current click operation is complete
subscribeClickEvent();
}
subscribeClickEvent();