jquery.validate 如何自定义验证规则
$.validator.addMethod("isPassword", function(value, element) { var reg = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{6,20}$/; return reg.test(value); }, "密码中必须包含含数字、字母、特殊符号");
$('#formTeacherReg').validate({ rules: { UserPwd: { required: true, minlength: 5, isPassword:true }, teacherRePwd: { required: true, minlength: 5, equalTo: "#teacherPwd", isPassword:true }, },
添加引用即可
漫思