JSFiddle - React, Tailwind, and code Playground

by Laxmikant Dange

HTML

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

CSS

div {
    width:100px;
    height:100px;
    margin:5px;
    float:left;
    background-color:#F0F;
}

JavaScript

$('div').on({
    mouseover: function () {
        $this = $(this);
        if (!$this.hasClass("current"))return;
        $this.css('background-color', '#F00');
       
    },
    mouseout:function(){
        if($(this).hasClass("current"))return;
            $(this).addClass("current")
    }
})