按下Enter键后,即使使用提交按钮,表单也不会提交

时间:2019-02-06 09:41:14

标签: html css

与标题中一样,如果我按Enter键,则默认情况下不会提交我的表单。 我宁愿不添加js代码,但我无法解释,但我无法解释这是怎么回事。有什么建议么? 我也尝试更改输入中的按钮而没有结果。 如果我单击“登录”按钮,则该表单有效。

// 代替“#”,显然有一个指向另一个HTML页面的链接。如果我单击按钮都可以,那么我希望当用户输入电子邮件和密码时,他可以按Enter进行登录

<div class="login-box" style="display:block">
  <div class="form-header" style="padding-left:10px;padding-right:10px;">
    <div class="content-form">
      <form action="#" id="login-form" class="login-form smart-form client-form text-center">
        <div class="login-input">
          <input type="email" placeholder="Email Address" autocomplete='off' id="username" name="email" value="" tabindex="1" required><i class="fa fa-user fa-lg fa-fw" aria-hidden="true"></i>
          <b class="tooltip tooltip-top-right"><i class="fa fa-user txt-color-teal"></i> Please enter
    							                                                                               your email
    							                                                                               address/username</b>
        </div>
        <div class="login-input" style="margin-top:20px;">
          <input type="password" placeholder="Password" autocomplete='off' id="password" name="password" value="" tabindex="2">
          <i class="fa-lg fa-fw fa fa-lock"></i>
          <b class="tooltip tooltip-top-right"><i class="fa fa-lock txt-color-teal"></i> Enter your
    							                                                                               password</b>
          <div class="note"></div>
        </div>
        <div class="login-input hidden" style="margin-top:20px;text-align:right;">
          <input class="checkbox form-checkbox" type="checkbox" name="remember" checked="checked" id="check" />
          <label class="form-checkbox-label" for="check">Stay signed in</label>
        </div>
        <div style="margin-top:30px;">
          <button id="loginButton" type="submit" class="btn btn-login" tabindex="3">login</button>
        </div>
      </form>
    </div>
  </div>

1 个答案:

答案 0 :(得分:-2)

对于提交表单,您需要添加功能,而不是将“发件人”发送到服务器,如下所示:

TButton
相关问题