a button
与 type="button"
与 type="submit"
之间有区别吗?是否存在功能差异,或者它只是一个更容易阅读代码的描述性名称?
这与 input
不同吗?
原文由 akantoword 发布,翻译遵循 CC BY-SA 4.0 许可协议
a button
与 type="button"
与 type="submit"
之间有区别吗?是否存在功能差异,或者它只是一个更容易阅读代码的描述性名称?
这与 input
不同吗?
原文由 akantoword 发布,翻译遵循 CC BY-SA 4.0 许可协议
2 回答1.5k 阅读✓ 已解决
2 回答893 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
1 回答904 阅读✓ 已解决
2 回答786 阅读
1 回答775 阅读✓ 已解决
2 回答1.1k 阅读
来自 MDN :
至于
button
和input
之间的区别:button
可以有一个单独的值作为数据,而对于input
数据和按钮文本总是相同的:button
可以包含 HTML 内容(例如图像),而input
只能包含文本。button
可能更容易与 CSS 中的其他input
控件(如文本字段)区分开来。注意向后的浏览器兼容性。