Object doesn’t support property or method ‘forEach’

To make NodeList.forEach() method work on inter­net explorer, you will have to add the fol­low­ing poly­fill in your application.

(function () {
    if ( typeof NodeList.prototype.forEach === "function" ) return false;
    NodeList.prototype.forEach = Array.prototype.forEach;
})();

If this poly­fill helped in your work, let us how it helped you by your comments !

You may also like...

  • Mohamad Al-Baz

    Yes. Totally did the trick.. Thumbs Up !

  • Justin Oneill

    Thanks a TON!! This totally fixed my Microsoft EDGE bug!

  • Mohamed­musam­mil Shaffi

    Thanks. Its work­ing fine. As expected. Thank you so much.

  • http://danielzuzevich.com/ Daniel Zuze­vich

    Used this and another in con­junc­tion, and it works.

    (func­tion () {
    if ( typeof NodeList.prototype.forEach === “func­tion” ) return false;
    NodeList.prototype.forEach = Array.prototype.forEach;
    })();

    if (!Array.prototype.forEach) {
    Array.prototype.forEach = function(fn, scope) {
    for(var i = 0, len = this.length; i < len; ++i) {
    fn.call(scope, this[i], i, this)
    }
    }
    }

    Just using your code doesn’t work. Needed to extend the Array prototype.

  • Gorm Kjeld­sen

    Thanks a lot. Worked like a charm, but damn, I’m sick of IE..