有没有办法在jquery验证插件中创建一个允许你说不包含“value”的规则?
答案 0 :(得分:4)
你可以add method
jQuery.validator.addMethod("notcontainfoo", function(value, element) {
return value != 'foo';
}, "You can't fill this with 'foo' !! ");
答案 1 :(得分:3)
doesnotContain: function(value, element, param) {
return this.optional(element) || !(value.indexOf(param)>=0);
},
那样的东西?