开发者

jQuery Validation: style "valid" fields

I'm using jQuery Validation and I know how to style the "invalid fields". However, I also want to开发者_运维技巧 style the "valid fields".

Is there some way to do it using the jQuery Validation plugin?

Thanks!


You can use like this

$ ("#form1").validate({        

    highlight: function (element, errorClass) {
        $(element).css({ "background-color": ErrorClass });
    },

    unhighlight: function (element, errorClass) {
        $(element).css({ "background-color": SuccessClass });            
    }
});


According to the docs, a valid class is added to elements that have been validated and are considered valid. This can be set by the validClass option:

http://docs.jquery.com/Plugins/Validation/validate#toptions

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜