jQuery Validation - Highlight Radio Labels Only
- by Michael
I'm trying to use jQuery validation to highlight the labels for my radio buttons only, and not the labels for my other inputs. I have a label for my radio button set called 'type'. I can't seem to get it to work!
$(document).ready(function(){
$("#healthForm").validate({
highlight: function(element, errorClass) {
$(element).addClass(errorClass)
$(element.form).find("label[for='type']")
.addClass("radioerror");
},
unhighlight: function(element, errorClass) {
$(element).removeClass(errorClass)
$(element.form).find("label[for='type']")
.removeClass("radioerror");
},
errorPlacement: function(error, element) {
}
});
});