JSFiddle - React, Tailwind, and code Playground

by Manikandan Kalaivanan

HTML

<div class="box" id="one">
</div>
<div class="box" id="two">
</div>
<div class="box" id="three
re">
</div>

CSS

.box {
  outline: 1px solid red;
  height: 60px;
  width: 60px;
}

.red {
  background-color: red;
}

.blue {
  background-color: blue;
}

JavaScript

var $a = $('.box');
$a.load((function() {
    var i = 0;
    var colors = ['blue','red'];
    return function() {
        $('.box').addClass( colors[i = ++i % 2] ).unbind('load');
        $('#test')..addClass('move');
    };
})());