开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜