JSFiddle - React, Tailwind, and code Playground

by ululami

HTML

<div class="box1"></div>

CSS

div{
  width: 100px;
  height: 100px;
}

.box1{
  background: red;
}

.box2{
  background: green;
}

.box3{
  background: yellow;
}

JavaScript

$(function(){
  $('.box1').on('click',function(){
    $('.box1').removeClass().addClass('box2');
  })
  
  $('.box2').on('click',function(){
    $('.box2').removeClass().addClass('box3');
  })
})