JSFiddle - React, Tailwind, and code Playground

by akoptsov

HTML

<div>First</div>
<div>Second</div>
<div>Third</div>
<div>Forth</div>

CSS

.style1{
    background-color: red;
}

.style2{
    background-color: green;
}

JavaScript

$(document).ready(function(){
  $('div').removeClass();
  $('div').addClass('style1');

  $('div').click(function(){
    $(this).removeClass();
    $(this).addClass('style2');
  });
});