JSFiddle - React, Tailwind, and code Playground
HTML
<button id="mybutton">click</button>
JavaScript
$('#mybutton').toggle(function() {
alert("a");
}, function() {
alert("b");
});
<button id="mybutton">click</button>
$('#mybutton').toggle(function() {
alert("a");
}, function() {
alert("b");
});