开发者

jQuery Validation add valid class to another element

开发者 https://www.devze.com 2023-02-22 08:01 出处:网络
Is there any equivalent of the errorPlacement for the validPlacement in jQueryValidation? My goal is to add the valid class to 开发者_如何学Canother 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消