JSFiddle - React, Tailwind, and code Playground
by igalst
HTML
<div class="wrap" id="wrap">
<div class="elem">I'm elem</div>
</div>
SCSS
.wrap {
padding: 20px;
background: pink;
}
.elem {
background: red;
&.active {
background: yellow;
}
}
JavaScript
$(".wrap").on("click mouseenter", function(e) {
var obj = $(this).children(".elem");
obj.toggleClass("active", e.type === "mouseenter");
});