JSFiddle - React, Tailwind, and code Playground

by Aamir Afridi

HTML

<div class="box" id="red"></div>

CSS

#red{
    width:100px;
    height:100px;
    background:red;
}
#blue{
    width:100px;
    height:100px;
    background:blue;
}

JavaScript

$(".box").click(function () {
    var $this = $(this);
    $this.attr("id", $this.attr("id") == "red" ? "blue" : "red");
});