如何在表单中输入提交按钮 [英] How to make enter the submit button in a form

查看:130
本文介绍了如何在表单中输入提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有登录我的网站的表单。我需要这样做,以便当用户输入时,表单提交。我怎样才能做到这一点?请提供代码。

 < form id =loginaction =myHome.phpmethod =POST> 
< input type =textname =emailid =email/>
< br />
< br />
< input type =textname =passwordid =password/>
< / form>


解决方案

你真的尝试过什么吗?

您需要添加一个< input type =submit> 并用CSS隐藏它,这样浏览器知道在按下输入时要触发什么,但仍未显示按钮。为了便于使用,我会显示按钮,即使没有那么多人使用它(输入更好)。

I have a form for logging into my website. I need to make it so that when the user hits enter, the form submits. How can I do this? Please provide code. Thanks.

          <form id="login" action="myHome.php" method="POST">
            <input type="text" name="email" id="email"/>
            <br/>
            <br/>
            <input type="text" name="password" id="password"/>
          </form>

解决方案

Have you actually tried anything?

You need to add an <input type="submit"> and hide it with CSS so that the browser knows what to trigger when enter is pressed, yet still not show a button. For the sake of accessibility and ease of use, I'd show the button even if not that many people use it (enter is much nicer).

这篇关于如何在表单中输入提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆