1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > angularjs中按回车事件_Angular中form表单中input自动响应回车事件

angularjs中按回车事件_Angular中form表单中input自动响应回车事件

时间:2022-09-18 10:59:13

相关推荐

angularjs中按回车事件_Angular中form表单中input自动响应回车事件

这是表单默认提交动作,跟ng无关。

如楼上所说将button,type改成非submit,或者不用form。

扩展来说其实这个问题很多人没搞清,我这里来总结以下吧~

Attributes for form submission can be specified both on form elements and on submit buttons (elements that represent buttons that submit forms, e.g. an input element whose type attribute is in the Submit Button state).

表单的提交行为,可以用两种方式定义,一是form表单自身,二是form表单的button元素(包括type=submit的input标签,以及type=submit的button元素,button默认type为submit)

而按enter键会触发form表单提交,这称为隐式提交。这是为了让那些使用辅助阅读工具使用者(比如屏幕阅读器)或不方便使用鼠标者所设立的

There are pages on the Web that are only usable if there is a way to implicitly submit forms, so user agents [browsers] are strongly encouraged to support this

当用户在一个表单的input标签按enter按钮时,浏览器会找到表单中的第一个提交按钮(submit button),并触发click,同时提交表单。

如果一个表单里没有任何submit button。当这个表单只有一个input元素时,在这个input

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。