javascript access collections of elements

Solutions on MaxInterview for javascript access collections of elements by the best coders in the world

showing results for - "javascript access collections of elements"
Ginny
11 May 2017
1<div class="wrapper">
2  <p class="box">Food</p>		<!-- Index Position 0 -->
3  <p class="box">Drink</p>		<!-- Index Position 1 -->
4  <p class="box">Books</p>		<!-- Index Position 2 -->
5  <p class="box">Whatever</p>	<!-- Index Position 3 -->
6</div>
7
8<script>
9var myCollection = document.getElementsByClassName("box");
10console.log(myCollection)
11myCollection[0].innerHTML = "I can change everything!"
12</script>
similar questions
queries leading to this page
javascript access collections of elements