JSFiddle - React, Tailwind, and code Playground
by Daniel Lamb
HTML
<input id="change" type="checkbox">
<label for="change">Check me</label>
<div id="example"></div>
CSS
#example {
width:50px;
height: 50px;
background: blue;
}
.red {
background: red !important;
}
JavaScript
// jQuery
$("#change").change(function () {
$("#example").toggleClass('red', $(this).prop("checked"));
});