Answers for "how to loop through all elements in the document and select based on class name"

5

javascript loop through class elements

var els = document.getElementsByClassName("myClass");
for(var i = 0; i < els.length; i++)
{
  console.log(els[i]);
}
Posted by: Guest on February-25-2020

Code answers related to "how to loop through all elements in the document and select based on class name"

Code answers related to "Javascript"

Browse Popular Code Answers by Language