文本框上的JQuery验证错误

时间:2013-10-08 10:39:53

标签: jquery jquery-validate

我在MVC 4视图中有以下HTML表单

@using (Html.BeginForm("Index", "ManageAdministrator", FormMethod.Post, 
        new Dictionary<string, object> {{"id", "manageAdministratorForm"}}))
{
    @Html.TextBox("emailAddressTextbox", null,
                  new Dictionary<string, object> {{"id", "emailAddressTextbox"}})
}

我想使用以下代码应用JQuery验证

$(document).ready(function() {
    $("#saveButton").click(function () {
        $("#manageAdministratorForm").validate({
            rules: {
                emailAddressTextbox: {
                    required: true
            }
        },
        comment: "The email address is required"
    });
  });
});

执行验证时,我得到以下错误

 JavaScript runtime error: Unable to get property 'call' of undefined or null reference

1 个答案:

答案 0 :(得分:0)

此问题是由我使用的JQuery Validation插件引起的。 我使用Nuget更新到最新的JQuery Validation Plugin(1.11),现在一切正常。

希望这对将来有所帮助。

相关问题