开发者

Changing behavior of jQuery Validation plugin

开发者 https://www.devze.com 2023-03-09 00:24 出处:网络
I\'ve been reading the documentation of a jQuery Validation Plugin and for some reason I couldn\'t find a way to change the behavior

I've been reading the documentation of a jQuery Validation Plugin

and for some reason I couldn't find a way to change the behavior

开发者_运维技巧

I'm trying to get it to color the input's background in red, instead of writing

anything.. is there perhaps a similar plugin that does that already?


Use highlight and unhighlight

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

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

These can be added just below rules


You can control anything in the Validation plugin. Search in the API for a callback method called showErrors. You can use it to customize error rendering

0

精彩评论

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