JSFiddle - React, Tailwind, and code Playground
HTML
<div id="testTimer">
</div>
JavaScript
function Timer() {
var counter = 10;
var myTimer = setInterval(function() {
document.getElementById("testTimer").innerHTML = counter;
counter--;
if (counter < 0) {
clearInterval(myTimer);
document.getElementById("testTimer").style.color = "red";
// do anything then time is up. ex: submit() function
document.getElementById("cntnt01moduleform_1").submit();
}
}, 1000);
}
Timer();