resin
07-24-2012, 11:19 AM
Hello, I'm having trouble getting the setTimeout to work with my form submission. I want the form to submit 3 seconds after I click the submit button (to allow a confirmation message to be faded in and out). Here is what I have curently, but the setTimeout seems to be getting ignored for some reason, and the form just submits right away as if there was no setTimeout on it at all (therefore the confirmation message is not allowed enough time to fade in and out entirely, before being taken to the target url that the submit button takes you to after submitting the form)-
$('#formSubmitButton').click(function() {
$('#formMessageSentConfirmation').fadeIn(1000).delay(1000).fadeOut(1000);
setTimeout(function() { if (!validate(form)) return; }, 3000)
setTimeout(function() { form.submit(); }, 3000)
});
It's the last two lines here that I want to set a delay of 3 seconds on. How can I do this?
$('#formSubmitButton').click(function() {
$('#formMessageSentConfirmation').fadeIn(1000).delay(1000).fadeOut(1000);
setTimeout(function() { if (!validate(form)) return; }, 3000)
setTimeout(function() { form.submit(); }, 3000)
});
It's the last two lines here that I want to set a delay of 3 seconds on. How can I do this?