1
我使用自定義的驗證了我的領域爲什麼我在Internet Explorer 7.0和8.0出現錯誤?
<div class="control-group">
<label class="control-label" for="region">Region*</label>
<div class="controls">
<input type="text" class="input-xlarge" id="region" name="region" minlength="1" maxlength="50" autocomplete="off">
</div>
</div>
var regionsList = ["value1", "value2", ..., "value 80"];
$.validator.addMethod("validRegion", function (value, element, param) {
return this.optional(element) || (param.indexOf(value) != -1); // ERROR IS HERE
}, "Please start to type and choose correct value");
$("#myform").validate({
rules: {
"region": {
required: true,
validRegion: regionsList
},
...
什麼可能是錯誤的,在這條線(請認準帶有註釋錯誤的行就在這裏)? 錯誤是Object doesn't support this property or method
。
是的,請告訴詳情。什麼是錯誤? – jsalonen
@pst,該行已被提供,請在代碼中查找註釋。並且我添加了錯誤消息。 –
@jsalonen,更新了問題。 –