jquery验证无法正常工作。当我删除图像验证后,它可以正常工作 我确定该问题表格图像正确,但是如何解决? 有办法吗?
$("#admin_changes").validate({
errorPlacement: function(error, element) {
if (element.hasClass("image-validate")) {
error.insertAfter('#image-lable');
}
else{
error.insertAfter(element);
}
},
ignore: "",
rules:{
image:{
required: false,
extension: "png|jpe?g",
filesize : 300000,
},
name:{
required: true,
//maxlength: 50
},
login:{
//maxlength: 50,
required: true,
},
},
messages:{
name: {
required: "<p style='color:red'>please enter name<p>",
//maxlength: "<p style='color:red'>text should be shorter than 50<p>",
},
login: {
required: "<p style='color:red'>please enter login<p>",
//maxlength: "<p style='color:red'>text should be shorter than 50<p>",
},
image:{
extension: "<p style='color:red'>file must be png, jpg or jpeg<p>",
filesize: "<p style='color:red'>file is very big<p>",
}
}
});
运行此代码时,验证das在上载图像之前不起作用,但是当我删除图像的验证时,所有验证都开始工作