简体   繁体   中英

In IE11 Symbol.Iterator is giving error when i am using for each on array of elements?

I am trying to loop an array of buttons and creating react component button at runtime, the error is reproducible only in IE 11 , I'm getting error in Symbol. Iterator which means that the array i am passing is non valid and internal iterator cannot be returned, but this works fine with any other browser, Is it a problem with IE or i am using jQuery selector to get the array of buttons.

export default function(buttons){

   for(let button of buttons){
       //Code for creating button as react component button.
   }
}

//call to replaceButtons


var btns = $('.continue-buttons');
replaceButtons(btns);

Getting error with SYMBOL.ITERATOR

I know this is not optimized way to write react code but requirement and design is quite a challenge.

jQuery does not return an array, it returns a jQuery collection. Which isn't iterable indeed. It actually is since v1.12/v2.2.

However, Internet Explorer 11 just doesn't support iterators or for of loops at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM