I am having issues getting a JS loop to work over 4 elements on a page in IE11. I want the function hideImg
to run on mouseover on the element that you hovered over.
Here is my code:
elements.forEach( function(element) {
element.addEventListener('mouseover', hideImg);
});
I think I've found that forEach
loops are not supported in IE, how can I easily convert this to a for
loop in plain JS?
Kind regards,
Steve
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…