jQuery Validation add valid class to another element
Is there any equivalent of the errorPlacement for the validPlacement in jQueryValidation?
My goal is to add the valid class to 开发者_如何学Canother element.
Thanks.
I solved the problem using success option.
var validatorOptions = {
success: function(label) {
var element = '#' + label.attr('for');
$(element).addClass('myClass');
}
};
You can write a custom validation function. A custom validation function takes 2 arguments: value and element
That gives you access to the element parameter.
精彩评论