I am using jquery.validate.js for validation along with jquery-1.9.1.js and it is working fine in all browsers but not in Ie7
Below is my code
<script type="text/javascript" src="/scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="scripts/jquery.validate.js"></script>
<script type="text/javascript" src="scripts/rwQueryString-1.0.jquery.min.js"></script>
<script>
$(function () {
var ruleSet_default = {
required: true
};
var ruleSet1 = {
minlength: 2,
maxlength: 20,
customvalidation: true
};
$.extend(ruleSet1, ruleSet_default); //combines defaults into 1
var ruleSet2 = {
email: true
};
$.extend(ruleSet2, ruleSet_default); // combines default into 2
$("#customForm").validate({
//focusCleanup: true,
rules: {
"<%= txtFirstName.UniqueID %>": ruleSet1,
"<%= txtLastName.UniqueID %>": ruleSet1,
"<%= txtPosition.UniqueID %>": ruleSet_default,
"<%= txtEmail.UniqueID %>": ruleSet2,
"<%= txtCompanyName.UniqueID %>": ruleSet_default,
"<%= txtCompanyAddress.UniqueID %>": ruleSet_default,
"<%= txtCity.UniqueID %>": ruleSet_default,
"<%= txtProvince.UniqueID %>": ruleSet_default,
"<%= txtCountry.UniqueID %>": ruleSet_default,
"<%= txtPostalCode.UniqueID %>": ruleSet_default
},
highlight: function (element) {
$(element).addClass("error");
$(element).removeClass("OK");
},
unhighlight: function (element) {
$(element).removeClass("error");
$(element).addClass("OK");
},
messages: {
"<%= txtFirstName.UniqueID %>": {
required: "Please, enter a name",
minlength: $.format("Keep typing, at least {0} characters required!"),
maxlength: $.format("Whoa! Maximum {0} characters allowed!")
},
"<%= txtLastName.UniqueID %>": {
required: "Please, enter last name",
minlength: $.format("Keep typing, at least {0} characters required!"),
maxlength: $.format("Whoa! Maximum {0} characters allowed!")
},
"<%= txtPosition.UniqueID %>": "Please, enter your position",
"<%= txtEmail.UniqueID %>": {
required: "Please, enter your email",
email: "Your email address must be in the format of name@domain.com"
},
"<%= txtCompanyName.UniqueID %>": "Please, enter your company name",
"<%= txtCompanyAddress.UniqueID %>": "Please, enter your company address",
"<%= txtCity.UniqueID %>": "Please, enter your city",
"<%= txtProvince.UniqueID %>": "Please, enter your province",
"<%= txtCountry.UniqueID %>": "Please, enter your country",
"<%= txtPostalCode.UniqueID %>": "Please, enter your zip code"
}
});
$.validator.addMethod("customvalidation",
function (value, element) {
return /^[A-Za-z\d=#$%@_ -]+$/.test(value);
},
"Sorry, no special characters allowed"
);
});
</script>
I got this error while try to run this in IE7
0x80020003 - JavaScript runtime error: Member not found. in jquery-1.9.1.js
but when I comment out jquery-validate.js code then jquery-1.9.1.js doesn't produce any problem in IE7.
Please help because I am stuck here for last few days.
Thanks
Jquery 1.9 and newer versions don't support IE6/7/8, well, it may work but there is no guarantee.
Use jquery 1.8.3 it supports old browsers including Opera 9
User contributions licensed under CC BY-SA 3.0