自定义验证方法
jQuery.validator.addMethod("wordmaxlength", function(value, element,param) {
var attr = value.split(" ");
return attr.length <=param;
},"最多30个单词");
验证调用
rules: {
title: {
required: true,
minlength: 2,
maxlength:200,
wordmaxlength:30
},
网友评论