JSFiddle - React, Tailwind, and code Playground
by mpsingh2003
HTML
<button id="b1">
Click
</button>
<div class="test" id="d1">
</div>
CSS
.test {
background-color: red;
height: 200px;
width: 200px;
margin-top:10px;
transition: background-color 600ms ease-in;
}
.test2{
background-color:black;
}
JavaScript
document.getElementById("b1").addEventListener('click', ()=>{
document.getElementById("d1").classList.toggle('test2');
})