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");
    
    $sample.each(function(index) {
        if($(this).is(":hover")) {
           $(this).css("background", "yellow");
        }
        else {
           $(this).css("background", "");
        }
    });
    
    
}, 200);