re: How do I use .forEach on DOM Elements? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Well, in the mdn documentation it had mentioned this: However some older browsers have not yet implemented NodeList.forEach() nor Array.from() ...
 

I just tested it and it works on Chrome for me.

var elements = Array.from(document.querySelectorAll('p'));

// elements = (3) [p, p, p]

It might not be compatible with many browsers though, as you mentioned.

You don't have to go far - if you have Windows and IE11 installed, that doesn't support either 😉

code of conduct - report abuse