我正在使用验证插件使用 jQuery 表单验证。我已经用至少 7 个字符和一个大写字母和 oe 数字验证了密码。同时,当我发现密码有效时,需要在文本字段附近显示正确的图像。否则图片错误。
jQuery.validator.addMethod('mypassword', function(value, element) {
return this.optional(element) || (value.match(/[A-Z]/) && value.match(/[0-9]/));
},
'Password must contain at least one capital and one number.');
jQuery("#loanRequestDetailsForm").validate({
ignore: "",
rules : {
password: {
required: true,
minlength: 7,
mypassword :true
},
confirmpassword: {
required: true,
minlength: 7,
equalTo: "#password"
}
},
messages : {
password : {
required:"Please provide a password",
minlength:"Your password must be at least 7 characters long"
},
confirmpassword : {
required:"Please provide a password",
minlength:"Your password must be at least 7 characters long",
equalTo: "Please enter the same password as above"
}
}
});
显示图像的任何想法