JSFiddle - React, Tailwind, and code Playground

HTML

<div class="sample">
</div>
<div class="sample">
</div>

CSS

.sample {
    width:200px;
    height:200px;
    background: #aaa;
}

JavaScript

setInterval(function(){
    var $sample = $(".sample");
    if($sample.is(":hover")) {
       $sample.css("background", "yellow");
    }
    else {
       $sample.css("background", "");
    }
}, 200);