Gab*_*vay 18 html javascript forms
我刚刚发现按Enter键时,只包含一个INPUT(未隐藏)的FORM将自动提交.
但是,按Enter键时,不会提交包含至少两个INPUTS(未隐藏)的表单.
(所有脚本都没有提交/按钮/输入[type = submit])
看看这个jsfidle.这种行为有解释/标准吗?
<form id="form1" method="POST">
<p>Does submit:</p>
<input type="text" placeholder="focus and press enter"/>
</form>
<form id="form2" method="POST">
<p>Does <strong>not</strong> submit:</p>
<input type="text" placeholder="does not submit"/>
<input type="text" placeholder=""/>
</form>
Run Code Online (Sandbox Code Playgroud)