JSFiddle - React, Tailwind, and code Playground

by skram

HTML

<div id="test"></div>

CSS

.hover { background-color: #ebebeb;   }

#test { border: 1px solid #c3c3c3; width: 200px; height: 200px;}

JavaScript

$("#test").hover(function(e) { // Mouse Over
    $(this).addClass("hover");
}, function(e) { // Mouse Out
    $(this).removeClass("hover");
});

$("#test").mouseenter(function() {
    console.log('Has class hover ' + $(this).hasClass('hover'));
}).mouseleave(function() {
    console.log('Has class hover ' + $(this).hasClass('hover'));
})