JSFiddle - React, Tailwind, and code Playground
by cchana
HTML
<div id="clickme">
click me ;)
</div>
<a href="#" id="toggle">turn alert on</a>
CSS
#clickme { width:200px; height:100px; text-align:center; background:#ccc; line-height:100px; margin-bottom:50px; }
JavaScript
var alertMe = 0;
$("#toggle").click(function(){
if (alertMe == 0){
$("#toggle").text('turn alert off');
alertMe = 1;
}
else {
$("#toggle").text('turn alert on');
alertMe = 0;
}
});
$("#clickme").click(function() {
if(alertMe == 0) {
alert("I can't be clicked :(");
} else {
alert("hey i could be clicked");
}
});