我是 jQuery 验证器的新手。
我正在制作 WordPress 网站,我正在使用http://bassistance.de/jquery-plugins/jquery-plugin-password-validation/插件密码验证。
jQuery 验证器不工作并且没有显示任何错误。
我一直在尝试很多无法解决的问题。
$(document).ready(function () {
$("#upme-registration-form").validate({
rules: {
user_login: {
required: true
},
user_email: {
required: true
},
user_pass: {
password: "#user_pass"
},
user_pass_confirm: {
required: true,
equalTo: "#user_pass_confirm"
}
},
messages: {
user_login: {
required: "Enter a username",
minlength: jQuery.format("Enter at least {0} characters")
},
user_email: {
required: "Enter a username",
minlength: jQuery.format("Enter at least {0} characters")
},
user_pass_confirm: {
required: "Repeat your password",
minlength: jQuery.format("Enter at least {0} characters"),
equalTo: "Enter the same password as above"
}
},
// the errorPlacement has to take the table layout into account
errorPlacement: function (error, element) {
error.prependTo(element.parent().next());
},
// specifying a submitHandler prevents the default submit, good for the demo
submitHandler: function () {
alert("submitted!");
},
// set this class to error-labels to indicate valid fields
success: function (label) {
// set as text for IE
label.html(" HELLo").addClass("checked");
}
});
});
我在submitHandler 和 .validate() 问题的帮助下制作了上面的代码,但无法工作
谢谢你
请帮忙