我正在使用字段验证,需要在用户登录之前输入。然而,我遇到了一个问题。我在html的输入标签中使用了required标签,但当用户单击登录按钮时,没有消息告诉他们这些字段是必需的。
我一直在研究w3Schools,其中指出如果用户在未填写必填字段的情况下尝试点击提交,将会触发required消息提示。
有什么建议吗?
我一直在研究w3Schools,其中指出如果用户在未填写必填字段的情况下尝试点击提交,将会触发required消息提示。
有什么建议吗?
<div class="tab-pane fade show" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<br />
<h3 style='color: #fff;' class="register-heading">Log in to view your <span style='font-weight: bold;'>dashboard</span></h3>
<div class="row register-form">
<div class="col-md-12">
<div class="form-group">
<input id="login-email" type="email" class="form-control" placeholder="Email *" value="" required/>
</div>
</div>
<div class="form-group col-md-12">
<input id="login-password" type="password" class="form-control" placeholder="Password *" value="" required />
</div>
<div class="col-md-2"></div>
<div class="col-md-6">
<input class="btnRegister pull-left" id="login-btn" type="submit" value="Login"/>
</div>
<div class="col-md-4"></div>
</div>
</div>
<form>
标签。 - ps2goatrequired
属性是 HTML5 中的新属性,因此请确保在 HTML 开头有<!DOCTYPE html>
。 - Dominique Fortin