[英]Javascript/jQuery auto submit form
Working on a 3rd party js script for Slate and need to switch the line form.on('submit', function()
to have the submit button fire automatically. I don't need user clicking on submit button. It looks like form.on('submit', function()
is a mouse click event to click the submit button? I need to integrate the below with $('#myForm').submit();
somehow I suspect. Can you integrate FW.Lazy.Commit(this, { cmd: 'submit' });
in $('#myForm').submit();
to achieve the functionality?在 Slate 的第 3 方 js 脚本上工作,需要切换行
form.on('submit', function()
以自动触发提交按钮。我不需要用户点击提交按钮。它看起来像form.on('submit', function()
是单击提交按钮的鼠标单击事件?我需要将下面的内容与$('#myForm').submit();
以某种方式集成,我怀疑。你能集成FW.Lazy.Commit(this, { cmd: 'submit' });
在$('#myForm').submit();
实现功能?
This works for manual submit:这适用于手动提交:
<script async="async"> /*<![CDATA[*/
$( document ).ready(function() {
var form = $('#myForm');
form.on('submit', function()
FW.Lazy.Commit(this, {
cmd: 'submit'
});
);
})(FW.$);
/*]]>*/
</script>
Submit HTML提交HTML
<form id="myForm"...>
<button class="default form_button_submit" id="mySubmit" type="button">Submit</button>
</form>
This didn't work for me这对我不起作用
<script async="async"> /*<![CDATA[*/
$( document ).ready(function() {
$('#myForm').submit(function()
FW.Lazy.Commit(this,
{
cmd: 'submit'
} );
);
})(FW.$);
/*]]>*/
</script>
You can try this:你可以试试这个:
$("#form-id...").submit(); // in which event you submit this
OR:或者:
$("#form-button").trigger('click'); // the form is automatically submit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.