jQuery timeout function after validation
I use this function to validate my form:
<script type="text/javascript">
$(document).ready(function() {
$('#tracks_form').validate({
submitHandler: function(form) {
form.submit();
}
})
});
<开发者_开发问答;/script>
What I need is to create a timeout function inside this one.
so, as soon as the form has been validated, it will stop the page for about 2-3 seconds and THEN will finally submit the form.
How do I modify this function to achieve this result?
Thank you so much!
You can use setTimeout
to delay the form submit
$(document).ready(function() {
$('#tracks_form').validate({
submitHandler: function(form) {
setTimeout(function(){
form.submit();
}, 3000);//Time in milliseconds
}
})
});
精彩评论