jQuery触发HTML5表单验证

时间:2014-01-24 12:16:31

标签: javascript jquery html html5 validation

我有以下格式的HTML代码:

<form id="login_information_form" class="form uniformForm validateForm">
              <div class="field-group">
                <label for="email">Email:</label>
                <div class="field">
                  <input type="text" class="validate[required,custom[email]" size="32" id="email" name="email" value="">    
                </div>
              </div>


              <div class="field-group">
                <label for="oldpass">Old Password:</label>
                <div class="field">
                  <input type="password" class="validate[required]" size="32" id="oldpass" name="oldpass" value=""> 
                </div>
              </div> <!-- .field-group -->

              <div class="field-group">
                <label for="newpass">New Password:</label>
                <div class="field">
                  <input type="password" class="validate[required]" size="32" id="newpass" name="newpass">  
                </div>
              </div> <!-- .field-group -->

              <div class="field-group">
                <label for="newpassr">Repeat New Password</label>
                <div class="field">
                  <input type="password" class="validate[required]" size="32" id="newpassr" name="newpassr">    
                </div>
              </div> <!-- .field-group -->


              <div class="actions">                     
                <button class="btn btn-blue" id="save_login_info" type="submit">Save Password</button>
              </div> <!-- .actions -->

            </form>

目前,只要输入失去焦点,HTML5就会触发验证。

当我点击“保存密码”按钮时,是否可以使用jQuery触发此表单的验证?

修改

我的问题是错的。我可以为特定输入字段触发提示气泡。例如:新密码和重复新密码不正确。所以我想在显示错误消息

的输入字段上显示一个气泡

0 个答案:

没有答案