I have a form that I am stopping from submitting with e.preventDefault(). (I've also tried return false).
I would manually tell the form to submit after a short delay, using the code:
$('form').delay(2000).submit();
Unfortunately, e.preventDefault() seems to disable the form from submitting even if it explicitly submitted using the submit()
function.
Any idea how I can combine these intentions? I'd like to show a loading screen for a couple of seconds.
Thanks!
$("form").on('submit.blocker', function (e) {
setTimeout(function () {
$("form").off('submit.blocker').trigger('submit');
}, 2000);
e.preventDefault();
});
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