如何寻找 form 表单里面的 input

$("from") 之后如何向下查找 表单里面的input

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


喵喵时光机
浏览 723回答 1
1回答

qq_遁去的一_1

<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){&nbsp; &nbsp;var success = false;&nbsp; &nbsp;$(targetForm).find(":input[type='text']").each(function(){&nbsp; &nbsp; &nbsp; &nbsp;//do something&nbsp; &nbsp;});&nbsp; &nbsp;return success;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript