I have a razor view in ASP.NET MVC3 application.
This view has 2 partialviews
As part of validation atleast one checkbox must be checked to continue with the save.
Following is the jquery code that is giving me error: Object does not support this property or method.
Error occuring at this line of code: $("#form0").validate({ rules: { issueCheckBox: { selectNone: true}} });
Following is the JQuery code:
<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script>
$.validator.addMethod
(
"selectNone",
function (value, element) {
var n = $("input[name='issueCheckBox']:checked").serializeArray();
if (n.length < 1) {
$("#divIssueCheckBoxError").show();
$("#divIssueCheckBoxError").css("color", "red");
$("#divIssueCheckBoxError").text("Issue(s) Required. Please select atleast one issue.");
return false;
}
else {
$("#divIssueCheckBoxError").hide();
return true;
}
},
function () { }
);
jQuery(document).ready(function () {
$("#form0").validate({ rules: { issueCheckBox: { selectNone: true}} });
});
</script>
Does this error only happen in IE9? If so, it may just be this jquery ie9 bug related getElementsByTagName.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.