延迟后使用jQuery提交表单 [英] submit a form with jQuery after delay
本文介绍了延迟后使用jQuery提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在HTML中有一个非常简单的表单,我希望在文档准备好后2000ms(延迟)后提交此表单,而不必按下提交按钮。
如何使用jQuery脚本来做到这一点?
< form id =my_formaction =NextPage .phpmethod =post>
< fieldset class =my_fieldset>
< input type =radioname =my_radiovalue =value_Achecked =checked/>值A< br />
< input type =radioname =my_radiovalue =value_B/>值B< br />
< / fieldset>
< input type =submitvalue =Sendid =Sendtabindex =110>
< / form>
我无法找到一个命令来说何时......提交表单。 p>
解决方案
< pre $
$(function(){
$('#my_form')。delay(2000).submit();
});
I have a very simple form in HTML and I'd like to submit this form after 2000ms (of delay) from when the document is ready, without push the submit button. How can I do this with a jQuery script?
<form id="my_form" action="NextPage.php" method="post">
<fieldset class="my_fieldset">
<input type="radio" name="my_radio" value="value_A" checked="checked"/>Value A<br/>
<input type="radio" name="my_radio" value="value_B"/>Value B<br/>
</fieldset>
<input type="submit" value="Send" id="Send" tabindex="110">
</form>
I can't find a command to say "when ... submit the form".
解决方案
You need to wait with delay() function and then submit() the form itself:
$(function() {
$('#my_form').delay(2000).submit();
});
这篇关于延迟后使用jQuery提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文