<button> 时的标准行为是什么?元素被点击?它会提交表格吗? [英] What's standard behavior when <button> element is clicked? Will it submit the form?
本文介绍了<button> 时的标准行为是什么?元素被点击?它会提交表格吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在表单中单击 元素时的标准行为是什么?它会提交表单吗?
What is the standard behavior for when a <button>
element is clicked in a form? Will it submit the form?
问题是关于标签/元素,而不是
.
Question is about tag/element <button>
, not <input type=button>
.
推荐答案
如果按钮在表单内,则默认行为是提交.
If the button is within a form, the default behavior is submit.
如果按钮不在表单中,它什么都不做.
If the button is not within a form, it will do nothing.
但要注意!
总是指定类型属性按钮.默认类型为Internet Explorer 是按钮",而在其他浏览器(以及 W3C规范)是提交".
Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".
取自 http://www.w3schools.com/tags/tag_button.asp
这篇关于<button> 时的标准行为是什么?元素被点击?它会提交表格吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文