JSFiddle - React, Tailwind, and code Playground
HTML
<form onsubmit='return test();'>
<input type="text" />
<input type='submit' id="submit" class="check" />
</form>
<div id="message" />
JavaScript
function test() {
var submit = document.getElementById("submit");
var message = document.getElementById("message");
if (submit.className == "check") {
submit.setAttribute("disabled");
var inc = 10;
message.innerHTML = "you have " + inc + " seconds left, check the form";
var interval = setInterval(function () {
inc--;
message.innerHTML = "you have " + inc + " seconds left, check the form";
if (inc <= 0) {
clearInterval(interval);
message.innerHTML = "you can now submit the form";
submit.removeAttribute("class");
submit.removeAttribute("disabled");
}
}, 1000);
return false;
}
}