JSFiddle - React, Tailwind, and code Playground

by Nic Fontaine

HTML

<div id="div">
arstarst
</div>
<button onclick="change()">
change
</button>

CSS

div {
  padding: 20px;
  background: transparent;
  transition: background 0.5s;
}

div.oh {
  background: deeppink;
  transition: none;
}

JavaScript

function change() {
	document.getElementById("div").classList.toggle("oh")
}