基于jquery.validate.min.js,添加自定义的check方法,实例如下:
jQuery.validator.addMethod("ip", function (b, a) { return this.optional(a) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(b) && (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256)); }, "\u8bf7\u8f93\u5165\u6b63\u786e\u7684IP\u5730\u5740"); jQuery.validator.addMethod("busirequired", function (b, a) { return b && jQuery.trim(b) != "" && b != "-1"; }, "\u8bf7\u9009\u62e9\u6b63\u786e\u7684\u9009\u9879");?