JSFiddle - React, Tailwind, and code Playground
HTML
<div class="hidden"></div>
<button></button>
CSS
.hidden {
width: 100px;
height: 100px;
background-color: red;
}
.visible {
width: 100px;
height: 100px;
background-color: green;
}
button {
width: 20px;
height: 20px;
}
JavaScript
$(document).ready(function() {
$('button').click(function(){
if ($('div').hasClass('hidden')) {
$('div').removeClass('hidden').addClass('visible')
}else{
$('div').addClass('hidden').removeClass('visible')
}
});
});