JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn1">BTN1</button>
<button id="btn2">BTN2</button>
<button id="remove">CLEAR
</button
JavaScript
var testFxn = function () {
$('#btn2').click(function () {
alert('I clicked btn2');
});
}
var tVar = null;
jQuery(document).ready(function () {
$('#btn1').click(function () {
clearTimeout(tVar);
tVar = setTimeout(function () {
$('#btn2').click(function () {
alert('I clicked btn2');
});
}, 0);
});
});