JSFiddle - React, Tailwind, and code Playground

by Rich Costello

HTML

<p>Click the element below</p>

<div class="two"></div>

CSS

.one:before  { content: "class one"; color: blue; }
.two:before  { content: "class two"; color: green; }
.three:before  { content: "class three"; color: red; }

div { width: 100px; border: 1px green solid;  }

JavaScript

$('.three, .two, .one').click(function() {                             
    this.className = {
       one : 'one', two: 'two', three: 'three'
    }[this.className];
});