Milo-J Milo-J - 4 months ago 36
HTML Question

Jquery - .forEach() not working in IE8

I have created this little interaction for one of the platforms at work -

It works fine in all browsers apart form IE8. When I run the console it seems to be this section that it is having problems with..., function(item) {

Can someone show me an IE8 friendly alternative so I can make it compatible for the versions required?


Use the jQuery.each method:

jQuery.each(l, function(index, item){

If the target array is empty from start, you can use the method for this instead:

var a =, function(item){
  return jQuery(item).text();