jQuery Highlight Radio Labels Only
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-03-13T03:36:23Z
Indexed on
2010/03/13
3:37 UTC
Read the original article
Hit count: 363
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) {
}
});
});
© Stack Overflow or respective owner