html all collection code example
Example: javascript access collections of elements
<div class="wrapper">
<p class="box">Food</p> <!-- Index Position 0 -->
<p class="box">Drink</p> <!-- Index Position 1 -->
<p class="box">Books</p> <!-- Index Position 2 -->
<p class="box">Whatever</p> <!-- Index Position 3 -->
</div>
<script>
var myCollection = document.getElementsByClassName("box");
console.log(myCollection)
myCollection[0].innerHTML = "I can change everything!"
</script>