Javascript examples for Array Operation:Array Element
Get an array of element from html using getElementsByTagName() method
<html> <head> <script> var myList = document.getElementsByTagName('h1'); console.log(myList.length) //from w w w . j av a2s .c om </script> </head> <body> <div class="item"> <h1 id="Python">Python</h1> </div> <div class="item"> <h1 id="C++">C++</h1> </div> <div class="item"> <h1 id="PHP">PHP</h1> </div> </body> </html>