JSFiddle - React, Tailwind, and code Playground

by Afzaal Ahmad Zeeshan

HTML

<div>One</div>
<div>One</div>
<div>One</div>
<div>One</div>

CSS

.hovered {
    color: red;
}

JavaScript

$('div').hover(function () { // on a hover on a div
   $('div').attr('class', 'event'); // remove the class; keep the first one
   $(this).attr('class', 'hovered event'); // update the class for the current
})