JSFiddle - React, Tailwind, and code Playground
by luka kupunia
HTML
<div id="elem" class="active">active</div>
<button onclick="changeClass()">changeClass</button>
CSS
.active {
color: green;
}
.not-active {
color: red;
}
JavaScript
function changeClass(){
document.querySelector('#elem').classList.replace('active','not-active');
}