JSFiddle - React, Tailwind, and code Playground

by Pratik Bhonsle

HTML

<div class="testOn">TEST</div>
<button id="tog">Change</button>

CSS

.testOn {background-color:#3c3c3c;}
.testOff {background-color:#3c3c3c;}

JavaScript

$('#tog').click(function() {
    $('.testOn').toggleClass(function(i, c, s) {
        alert(i);
        alert(c);
        alert(s);
        return("testOff");
    }, true);
});