欢迎来到cool的博客
7

Music box

Click to Start

点击头像播放音乐
新博客链接

Jquery validation for confirm password 验证两次密码是否一致

<form id="formCheckPassword">
    <input type="password" class="form-control" name="password" id="password"/>
    <input type="password" class="form-control" name="cfmPassword" id="cfmPassword" />
    <input type="submit" value="submit"/>
 </form>

 $("#formCheckPassword").validate({
           rules: {
               password: { 
                 required: true,
                    minlength: 6,
                    maxlength: 10,

               } , 

                   cfmPassword: { 
                    equalTo: "#password",
                     minlength: 6,
                     maxlength: 10
               }

           },
     messages:{
         password: { 
                 required:"the password is required"

               }
     }

});

返回列表