JSFiddle - React, Tailwind, and code Playground

by imsky

HTML

<div id="test" class="big one sans phone">Hello world and </div>

CSS

.one {background:blue;color:#fff}
.two {background:yellow;color:#000}
.sans {font-family:sans-serif}
.big {font-size:24px}
.phone:after {content:"phone!"}

JavaScript

document.getElementById("test").onclick = (function(){
this.className = this.className.replace(/\bone\b/,"two");
});