Javascript examples for DOM:Document getElementsByClassName
Access the content of an HTML element from a node list
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from www. j a v a2s . co m var spanarray = document.getElementsByClassName("myclass"); spanarray[0].innerHTML = "ABC" } </script> </head> <body> <span class="myclass">Text</span> <span class="myclass">Text2</span> </body> </html>