JSFiddle - React, Tailwind, and code Playground
HTML
<div id="clickme"> Click me </div>
CSS
div{ background:#00CC00; display:inline-block; margin:20px; border-radius:5px; padding:20px;cursor:pointer;}
JavaScript
$('#clickme').click(function(){
var color = $(this).css('backgroundColor');
//alert("'"+color+"'");
if(color == "rgb(0, 204, 0)"){
alert("true");
$(this).css('backgroundColor', '#CC0000');
}else{
alert("false");
$(this).css('backgroundColor', '#00CC00');
}
});