You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何仅使用input标签实现提交按钮,而非button标签?

问题解决

你的原始代码:

<label>Please enter your name</label><br>
<input type="text" id="user0name"> <br>
<button type="button" id="userbutton"></button>
<input onclick="window.location.href = 'profile.html';" type="submit" value="submit" />

问题说明:

你尝试移除button标签的value属性(但实际上你的button标签并没有设置value属性),但按钮依然在页面上显示。

解决方法:

<button>是独立的页面控件,不管内部有没有文本内容,浏览器都会默认渲染出按钮样式。要让这个按钮消失,直接删除整个<button type="button" id="userbutton"></button>代码块即可,无需操作什么value属性。

内容的提问来源于stack exchange,提问作者Hypnotize-12

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 08:32:08