JSFiddle - React, Tailwind, and code Playground
by tr_santi
HTML
<div id="demo">
<br><br><br>
<button onclick="myFunction()">TRY</button>
</div>
CSS
* {
font-size: 50px;
}
#demo {
width: 100px;
height: 100px;
background-color: #f00;
transition: width 1s ease;
}
JavaScript
counter = 0;
function myFunction() {
document.getElementById("demo").style.width="0px";
counter+=10;
document.getElementById("demo").style.width=counter+"px";
}