如何让某人使用 Enter 键提交?
我制作了一个 URL 缩短器,但似乎每当我尝试更改任何内容时,缩短器都无法正常工作。
<input type="text" name="url" id="url" size="60"> <input id="submit" type="button" value="Shorten" >
I made a URL shortener but it seems like whenever I try to change anything the shortener doesn't work correctly.
<input type="text" name="url" id="url" size="60"> <input id="submit" type="button" value="Shorten" >
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就可以了(注意
type="submit"
)。看看这个 fiddle,在单击按钮并在文本输入字段中输入时提交表单。will do the trick (notice the
type="submit"
). Check out this fiddle, in submits the form on both button click and enter press while in text input field.