JSFiddle - React, Tailwind, and code Playground
HTML
<div id="one"></div>
<div id="two"></div>
CSS
#one {
width:200px;
height:200px;
background-color:yellow;
}
#two {
width:200px;
height:200px;
background-color:green;
JavaScript
setInterval(function(){
if($("#one:hover").length != 0) {
$("#one").css("background-color","red");
}
else {
$("#one").css("background-color","");}
},0);
if($("#two:hover").length != 0) {
$("#two").css("background-color","blue");
}
else {
$("#two").css("background-color","");
}
/*if ($('#element:hover').length != 0) {
// do something ;)
}*/