JSFiddle - React, Tailwind, and code Playground
HTML
<button id="theone">Does nothing...</button>
<button id="bind">Add Click</button>
<button id="unbind">Remove Click</button>
<div style="display:none;">Click!</div>
CSS
button {
margin: 5px;
}
button#theone {
color: red;
background: yellow;
}
JavaScript
function flash() {
$( "div" ).show().fadeOut( "slow" );
}
$("#bind").click(function () {
$("body")
.on("click", "#theone", flash)
.find("#theone")
.text("Can Click!");
});
$("#unbind").click(function () {
$("body")
.off("click.", "#theone", flash)
.find("#theone")
.text("Does nothing...");
});