我在 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