IE8 does not support Array.prototype.forEach #2339

replacing forEach with $.each should be compatible with older browsers.