You should play with highlight handler, which allows you to define a way of marking input as invalid:
jQuery.validator.setDefaults({
highlight: function(element, error, valid){
$(element).parent("div").addClass(error);
// or do whatever you want
}
});
please note that there is also another handler called unhighlight
which should be also implemented but in opposite way to first one. Here you have an example of it:
unhighlight: function(element, error, valid){
$(element).parent("div").removeClass(error);
// or do whatever you want but in opposite way
}
Full solution for your problem should looks like this:
jQuery.validator.setDefaults({
highlight: function(element, error, valid){
$(element).parent("div").addClass(error);
},
unhighlight: function(element, error, valid){
$(element).parent("div").removeClass(error);
}
});
Please note that code above should be included on site preferably after your jquery.validation.js, because it changing default behaviour of jQuery.validator. Advantage of doing it through jQuery.validator.setDefaults
is that your configuration will be applied on every single Form on your web site,