Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  147] [ 4]  / answers: 1 / hits: 44990  / 9 Years ago, sun, may 31, 2015, 12:00:00

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;
}

More From » javascript

 Answers
24

.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);
}

[#66395] Thursday, May 28, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
quentinaveryb

Total Points: 102
Total Questions: 100
Total Answers: 93

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
quentinaveryb questions
Thu, Aug 6, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;