提交输入字段更改的表单 [英] Submit form on change of input field
本文介绍了提交输入字段更改的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有多个输入复选框字段的表单。
< form action =method = 搞定 >
< input type =checkboxname =p []value =1>
< input type =checkboxname =p []value =2>
< input type =checkboxname =p []value =3>
< / form>
如何用jQuery完成?
change()事件,然后触发
submit() 表格
: $( 'form input')。change(function(){
$(this).closest('form')。submit();
});
I have a form with multiple input checkbox fields. I want to trigger form submit on change in any of the checkbox without submit button.
<form action="" method="get">
<input type="checkbox" name="p[]" value="1">
<input type="checkbox" name="p[]" value="2">
<input type="checkbox" name="p[]" value="3">
</form>
How it can be done with jQuery?
解决方案 You can hook to the change()
event of the checkboxes, then fire a submit()
on the form
:
$('form input').change(function() {
$(this).closest('form').submit();
});
这篇关于提交输入字段更改的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文