indexOf throwing error in IE8, I am using knockoutjs
This question already has an answer here:
Try this
return checkedPriceVals.toString()
.indexOf(priceObjects[i].fields.displayable.value())>=0;
it will work.
使用$ .inArray代替indexOf,或者你可以定义方法:
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
链接地址: http://www.djcxy.com/p/18960.html
上一篇: 如何使它工作