JSFiddle - React, Tailwind, and code Playground

by Tushar Gupta

HTML

<div>1.div (click me)</div><br />
<div>2.div (click me)</div><br />

JavaScript

function handler1() {
    alert('First handler: ' + $(this).text());
    $(this).one("click", handler2);
}
function handler2() {
    alert('Second handler: ' + $(this).text());
    $(this).one("click", handler1);
}
$("div").one("click", handler1);