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
$(function(){
$('#clickme').click(function(){
var color = $(this).css('background-color');
if(color == '#CC0000' || color == 'rgb(204, 0, 0)'){
$(this).css('background-color', '#00CC00');
}else{
$(this).css('background-color', '#CC0000');
}
});
});