Jquery - .forEach() not working in IE8
html, internet-explorer-8, javascript, jquery
Solution
Use the `jQuery.each` method:
jQuery.each(l, function(index, item){
a.push(jQuery(item).text());
});
If the target array is empty from start, you can use the `jQuery.map` method for this instead:
var a = jQuery.map(l, function(item){
return jQuery(item).text();
});
Problem
I have created this little interaction for one of the platforms at work - http://jsfiddle.net/S79qp/426/ 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... ``` Array.prototype.forEach.call(l, function(item) { a.push(jQuery(item).text()); }); ``` Can someone show me an IE8 friendly alternative so I can make it compatible for the versions required?