JSFiddle - React, Tailwind, and code Playground
HTML
<div class="ball" style="background:red;width:100px;height:100px">
</div>
<input type="button" value="Click Me" id="btn"/>
JavaScript
$(function(){
$("#btn").bind("click", function(){
alert($(".ball").css("visibility"));
if($(".ball").css("visibility") == "visible") {
$(".ball").css({ 'visibility': 'hidden'});
} else {
$(".ball").css({ 'visibility': 'visible'});
}
});
});