【发布时间】:2013-07-21 17:53:55
【问题描述】:
我刚刚发现一个只包含一个INPUT(未隐藏)的FORM在按Enter键时会自动提交。
但是一个包含至少两个输入(未隐藏)的表单在按下回车时不会提交。
(所有脚本都没有提交/按钮/输入[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>
【问题讨论】:
-
如果您将
input type=submit添加到第二个表单,它将提交。我正在寻找关于它的标准
标签: javascript html forms