JSFiddle - React, Tailwind, and code Playground

by Rich Costello

HTML

<button>Toggle</button>
<p>Hello</p>

JavaScript

$("button").click(function () {
    $("p").toggle(function() { 
        if ($(this).is(':visible')){ alert("visible"); }
        else if ($(this).is(':hidden')) { alert("hidden");}
    });
});