I want to disable my button on click and then reenable in after 5 seconds but its not working properly.
function submitPoll(id){
document.getElementById("votebutton").disabled = true;
document.getElementById("votebutton").delay(5000).disabled = false;
}
.delay
is jQuery. You can simply use setTimeout
in Javascript.
function submitPoll(id){
document.getElementById("votebutton").disabled = true;
setTimeout(function(){document.getElementById("votebutton").disabled = false;},5000);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With