jquery倒计时 - 自动提交表格到期? [英] jquery countdown - autosubmit form upon expiration?

查看:113
本文介绍了jquery倒计时 - 自动提交表格到期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery_countdown(http://keith-wood.name/countdown.html)设置60分钟的计时器。我知道我可以在时间到期时运行回调函数,但是有没有办法自动提交表单?

I'm using jquery_countdown (http://keith-wood.name/countdown.html) to set a 60-minute timer. I know that I can run a callback function on time expiration, but is there a way to automatically submit the form?

我尝试了以下操作,但未能提交(虽然在萤幕控制台中没有错误):

I tried the following, but it failed to submit (although, there were no errors in the firebug console):

<div class="countdown"></div>
<form id="formsamp" action="#">
<textarea name="bft"></textarea>
<input type="submit" name="op" value="Submit" />
</form>

jquery_countdown_add
(
    ".countdown", 
    array
    (
        "until" => 10, 
        "onExpiry" => "finished"
    )
);

function finished() { 
  $('#formsamp').submit(function(){return true;}); 
}


推荐答案

请尝试以下操作: p>

Try the following:

$('#formsamp').submit();

$('input[type=submit][name=op]').trigger('click');

这篇关于jquery倒计时 - 自动提交表格到期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆