Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  69] [ 4]  / answers: 1 / hits: 18689  / 13 Years ago, fri, october 28, 2011, 12:00:00

[I am quite new to jQuery so don't blame me if I get something wrong]



I have been browsing questions here on SO about: Disable submit button after click. OK there are loads of these stuff around, but I couldn't find out how to disable it for a limited time. e.g. 20 secs.



Maybe I am the idiot but how?



[I've only got a simple html form]


More From » jquery

 Answers
18
var enableSubmit = function(ele) {
$(ele).removeAttr(disabled);
}

$(#submit).click(function() {
var that = this;
$(this).attr(disabled, true);
setTimeout(function() { enableSubmit(that) }, 1000);
});


Demo: http://jsfiddle.net/pHxF2/2/


[#89401] Thursday, October 27, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
Mon, Jul 18, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Thu, Sep 10, 20, 00:00, 4 Years ago
;