Scott Moore wrote:
I set up a basic demo - http://nonsponsored.com/validation/ - but it's
really not much different than your example form. So with showErrors,
you're saying I'm able color the Name, Email and Password labels also?
I'm not quite following how you can target those labels.
Ok, I've tried around a bit, and while its easy to add the class (see
below), its not possible to remove it again. I'll try to find a nice
solution that I can build into the plugin.
$(document).ready(function(){
$("#userForm").validate({
focusInvalid: false,
event: "blur",
errorContainer: $("ul.error"),
errorLabelContainer: $("ul.error"),
wrapper: "li",
rules: {
name: { required: true },
email: { required: true, email: true },
password: { required: true }
},
messages: {
name: "Name is a required field.",
email: "Your email address is required.",
password: "Password is a required field."
},
showErrors: function(errors, validator) {
$.each(errors, function(key, value) {
$("[EMAIL PROTECTED]" + key +
"]").not(".error").addClass("highlight");
});
validator.defaultShowErrors();
}
});
});
--
Jörn Zaefferer
http://bassistance.de