Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

loop through htmlcollection

<script type="text/javascript">
        // get a HTMLCollection of elements in the page
        let collection = document.getElementsByTagName("p");//write your element
  
        // regular for loop
        for (let i = 0; i < collection.length; i++) {
            console.log(collection[i]);
        }
    </script>
 
PREVIOUS NEXT
Tagged: #loop #htmlcollection
ADD COMMENT
Topic
Name
6+8 =