在Enter键上提交登录

时间:2017-02-02 23:13:55

标签: javascript html

我正在尝试按Enter键提交登录,之前所有内容都在表单标记下,因此按Enter键可以正常工作。但是现在它不会,有人可以帮我解决这个问题。

HTML:

<div class="login-form">
    <p>Please Sign In</p>
    <div class="form-group" id="login-fields">
        <div class="cols-sm-10">
            <div class="input-group">
                <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"><span class="text--white glyphicon glyphicon-user"></span></i>
                </span>
                <input type="text" name="user" id="user" placeholder="Username" class="form-control" required/>
            </div>
        </div>
    </div>
    <div class="form-group" id="login-fields">
        <div class="cols-sm-10">
            <div class="input-group">
                <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"><span class="text--white glyphicon glyphicon-lock"></span></i>
                </span>
                <input type="password" name="pass" id="pass" placeholder="Password" class="form-control" required/>
            </div>
        </div>
    </div>
    <div>
        <input type="submit" value="Sign In" id="submit-login" onclick="save()" />
    </div>
</div>
</div>

1 个答案:

答案 0 :(得分:1)

您是否尝试在其周围放置一个表单标记并将eventlistener绑定到它:

glDrawArrays(GLenum(GL_TRIANGLES), 0, GLsizei(positions.count) * 2)