get elements by class and loop 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: how to loop over dom objects javascript
Array.from($('.'+$( this ).attr('id'))).forEach(function(obj){
console.log(obj);
});