loop through all elements with class javascript code example
Example 1: javascript loop through class elements
var els = document.getElementsByClassName("myClass");
for(var i = 0; i < els.length; i++)
{
console.log(els[i]);
}
Example 2: foreach element in class javascript
var slides = getElementsByClassName("slide");
for(var i = 0; i < slides.length; i++)
{
Distribute(slides[i]);
}