JSFiddle - React, Tailwind, and code Playground
by Brodingo
HTML
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
CSS
.box {
width: 100px;
height: 100px;
background-color: #eee;
}
.box:hover,
.active {
background-color: red;
}
JavaScript
var $box = $('.box');
$box.click(function(){
$box.removeClass("active");
$(this).addClass("active");
});