伙计们,我有这个样本表格:
<form method="POST" action="/some/url/method-to-handle-the-form">
some stuff here.
<input type="submit">
</form>
原来的功能是需要单击提交按钮来加载该操作,我想做的是让它自动添加此选择类型:
<select blah blah>
每当我在其中选择某些内容时,表单就会与我选择的选项一起提交。
最佳答案
$('#selectElementId').change(
function(){
$(this).closest('form').trigger('submit');
/* or:
$('#formElementId').trigger('submit');
or:
$('#formElementId').submit();
*/
});
关于jquery - 如何用jquery更改属性替换表单中的提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18526084/