Milo-J Milo-J - 1 year ago 167
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?

Answer Source

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();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download