添加规则时,Jqueryvalidation抛出错误

当我的js页面加载并且我创建了一个如下所示的规则时,我从jquery.validate.js库行#138中抛出一个错误,该错误表示“无法读取未定义的属性’设置’”

settings = $.data( element.form, "validator" ).settings; 

这是我正在添加的规则以及我正在添加的表单

 $('#zipCodeText').rules("add", { required: true, minlength: 5, maxlength: 5, messages: { required: "Required input", minlength: jQuery.validator.format("Please, {0} characters are necessary"), maxlength: jQuery.validator.format("Please, {0} characters are necessary") } }); 
 @using (Html.BeginForm("SaveLocation", "Manage", FormMethod.Post, new { @class = "form-horizontal", @id = "registerForm", role = "form" })) { 

@Html.EnumDropDownListFor(m => m.Countries, null, new { @id = "countryList", @class = "selectpicker btn-group-lg" })
}

JavaScript运行时错误:无法获取未定义或空引用的属性“设置”

必须首先通过调用表单元素上的.validate()方法来初始化插件。

 $('#yourform').validate({ // <-- INITIALIZE the plugin on your form // any options, rules, or callbacks });