nr.iras.sk
nr.iras.sk

Reputation: 8498

IE 8 does not support foreach method

This code not working in Internet Explorer 8.

documenttab.query('.field,.button').forEach(function(c){c.setDisabled(false);});

I get the error SCRIPT438: Object doesn't support property or method 'forEach'

Upvotes: 6

Views: 8146

Answers (3)

Derek
Derek

Reputation: 1196

Mozilla also publishes code for methods which you can put near the top of your JS and it will create them if they don't exist.

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach

Upvotes: 5

Dan
Dan

Reputation: 3367

I believe this should solve your issue.

vals = documenttab.query('.field,.button')
for (i = 0; i < vals.length; i++) {
    vals[i].setDisabled(false);
}

Upvotes: 4

Evan Trimboli
Evan Trimboli

Reputation: 30082

Ext has a forEach method. Where supported, it will defer to the native method:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Array-method-forEach

Ext.Array.forEach(documenttab.query('.field,.button'), function(c){
    c.setDisabled(false);
});

Upvotes: 3

Related Questions