I'm using jQuery Validation and I know how to style the "invalid fields". However, I also want to开发者_运维技巧 style the "valid fields".
Is there some way to do it using the jQuery Validation plugin?
Thanks!
You can use like this
$ ("#form1").validate({
highlight: function (element, errorClass) {
$(element).css({ "background-color": ErrorClass });
},
unhighlight: function (element, errorClass) {
$(element).css({ "background-color": SuccessClass });
}
});
According to the docs, a valid class is added to elements that have been validated and are considered valid. This can be set by the validClass option:
http://docs.jquery.com/Plugins/Validation/validate#toptions
精彩评论