Javascript examples for DOM:Element getElementsByClassName
access the value of HTMLCollection
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div class="review"></div> <div class="review"></div> <div class="review"></div> <div class="review"></div> <div class="review"></div> <script> var eles = document.getElementsByClassName('review'); console.log(eles); console.log(eles.length); console.log(eles[0]); console.log(eles[1]); console.log(eles[2]); /*from ww w. ja v a2s . com*/ </script> </body> </html>