[jQuery] Trying to get a submit button to countdown before being enabled again
Hi,
I am trying to get a submit button, once clicked, to disable itself,
countdown, then reenable itself to prevent a form from being submitted
too rapidly.
I've figured it out, but in a way that I think is pretty messy and not
very scalable, I'm wondering if I am going about this the wrong way
and if there is a more efficient way to code something like this?
---
$("#form-submit").attr("value",5).animate({opacity: 1.0}, 1000,
function() {
$("#form-submit").attr("value",4).animate({opacity: 1.0}, 1000,
function() {
$("#form-submit").attr("value",3).animate({opacity: 1.0}, 1000,
function() {
$("#form-submit").attr("value",2).animate({opacity: 1.0}, 1000,
function() {
$("#form-submit").attr("value",1).animate({opacity: 1.0}, 1000,
function(){
$("#form-submit").attr("disabled",false);
$("#form-submit").attr("value","Submit");
})
})
})
})
});
---
Thanks a lot!
Alan