IE 8 does not support foreach method

This code does not work in Internet Explorer 8.

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

I get error SCRIPT438: the object does not support the property or method 'forEach'

+6
source share
3 answers

Ext has a forEach method. Where supported, it will defer its 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); }); 
+3
source

Mozilla also publishes code for methods that you can install near the top of your JS, and it will create them if they do not exist.

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

+5
source

I believe this should solve your problem.

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

Source: https://habr.com/ru/post/920866/


All Articles