jQuery在表单提交之前暂停 [英] jQuery pause before form submit
问题描述
提交表格之前,我需要暂停500毫秒.这是我到目前为止的内容:
I need to pause for maybe 500 miliseconds before I submit a form. Here is what I have so far:
$(".rowqty input").bind("keyup", function() { $("#ViewCartPage form").animate({ opacity: 1.0 }, 3000).submit() });
因此,当某人更改输入字段的数量时,它将提交表单,但是我希望它等待一小段时间,以防他们需要一点时间来键入2或3个数字.
so when someone changes the quantity of the input field it submits the form, but I want it to wait for a slight amount of time incase they need a moment to type 2 or 3 numbers.
如您所见,我尝试了动画功能来尝试延迟事物,但是没有运气.
As you can see I tried the animate function to try and delay things but with no luck.
我知道我可以使用它: http://blog.mythin.net/projects/jquery.php
I know I could use this: http://blog.mythin.net/projects/jquery.php
如果可以解决的话,我宁愿不将另一个JS添加到我的网站中.
I'd rather not add another JS to my site if there is a way around it.
实际上上面的暂停插件对我也不起作用.
Actually the pause plugin above is not working for me either.
推荐答案
试一下:
$(".rowqty input").bind("keyup", function() { setTimeout("$('#ViewCartPage form').submit()", 500 });
这篇关于jQuery在表单提交之前暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!