javascript - IE jQuery 对象错误 SCRIPT5007

标签 javascript jquery internet-explorer

我正在尝试访问 JQuery 对象变量

var items = [];
function Item(id, position, content) {
  this.id = id;
  this.position = position;
  this.content = content;
}

我正在创建一个新元素

items.push(new Item(1, [0, 40], 'asd');

然后我在调用时循环遍历数组中的所有项目

item[i].position[0]

我收到错误 SCRIPT5007。在 Chrome 和 FF 中,这工作正常,唯一的问题是 IE。

最佳答案

将此行添加到您的标题

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

它会起作用!!

关于javascript - IE jQuery 对象错误 SCRIPT5007,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30030334/

相关文章:

jQuery Mobile(点击事件)

javascript - 调整字体大小以固定到div中

CSS: border-color 在 IE7-8 中使用 rgba

javascript - 在我打开控制台之前,IE9 脚本不会运行

javascript - 这是为嵌入式 JS 库提供回调的合适方法吗?

javascript - Bootstrap 弹出窗口 : Use of callbacks in order to show/hide overlay -doesn't work

javascript - 使用变量在 Highcharts 中设置仪表限制

html - 不要在 IE8 及以下版本中加载脚本?

javascript - 调用 s.tl() 不会填充 s.events

javascript - 使用javascript在iframe中查看多个url