$("from") 之后如何向下查找 表单里面的input$("from :input")这样可以找,但是我的页面有多个form 表单,判断用户选择了哪个表单之后提交的时候判断当前表单的内容是否可以提交, 怎么做?
1 回答

qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
<form action="" onsubmit="checkForm(this)">
<input type="text" name="input1">
<input type="text" name="input2">
<input type="text" name="input3">
<input type="submit" value="提交">
</form>
function checkForm(targetForm){
var success = false;
$(targetForm).find(":input[type='text']").each(function(){
//do something
});
return success;
}
添加回答
举报
0/150
提交
取消