我有以下内容:
<html>
<head>
</head>
<body>
<div>
<form method="post">
<div id="questions">
<label for="question-6">Name of Course:</label>
<input type="text" name="name_of_course[response]" value="" id="question-6" class="required">
<label class="control-label" for="reporting-year">Reporting Year: </label>
<select name="reporting_year" id="reporting-year">
<option value="-1" selected="selected">Select option...</option>
<option value="4">2013-2014</option>
<option value="1">2012-2013</option>
<option value="2">2011-2012</option>
<option value="3">2010-2011</option>
</select>
</div>
<input type="submit" name="submit" value="Save Entry" class="btn">
</form>
</div>
<script src="//code.jquery.com/jquery.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js"></script>
<script>
$(function(){
jQuery.validator.addMethod("notEqual", function(value, element, param) {
return this.optional(element) || value !== param;
}, "Please select an option");
$('form').validate({
rules:{
'reporting_year': {
notEqual: "-1"
}
}
});
});
</script>
</body>
</html>
大家最喜欢的浏览器,IE7(实际上是兼容性版本的IE10),在控制台报告了以下错误:
SCRIPT3: 找不到成员。
jquery.js,2525行4字符
当然,IE8及以上版本都可以正常工作,但我的客户正在使用IE7。