How to automatically submit a form after several seconds using jQuery
This article mainly introduces how to automatically submit a form after jQuery implements the form several seconds. The example shows how to implement the form delayed submission using jQuery. If you need it, refer
This example describes how to automatically submit a form after jqury is implemented several seconds. Share it with you for your reference. The details are as follows:
This code is set for many download websites. The Download button takes several seconds. After the Download button is complete, you can click Submit.
Easy to create:
1. Some JavaScript code is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<Script language = 'javascript '> <! -- $ (Document). ready (function (){ // # FormDownload ajaxForm $ ('# FormDownload'). ajaxForm ({ Target: '# formDownloadWindows', success: function (){ } }); }); Function jump (count, formId ){ Window. setTimeout (function (){ Count --; If (count> 0 ){ Condition ('{jumpnum'{.html (count ); Jump (count, str ); } Else { $ (Str). submit (); } },1000 ); } // --> </Script> |
2. Some HTML code is as follows:
?
1 2 3 4 |
<Form action = "/action/download" method = "post" id = "formDownload"> Wait <span id = "jumpNum"> </span> seconds <Input type = "button" onclick = "jump (30," # formDownload ");"/> </Form> |
I hope this article will help you with jQuery programming.