IE error jQuery object SCRIPT5007

I am trying to access a JQuery object variable

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

      

I am creating a new item

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

      

then i and looping through all the elements in the array when calling

item[i].position[0]

      

I am getting an error SCRIPT5007

. In Chrome and FF this works fine, only IE issue.

+3


source to share


2 answers


Add this line to your header

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

      



It will work!

0


source


I tried this on my local system. These are two errors:

  • Known Missing )

    :

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

to

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



  1. You are calling the wrong var name

item[0].position[0]

to

items[0].position[0]

Tried it locally and it works great!

0


source







All Articles