Access innerHTML on child node from element - Javascript DOM

Javascript examples for DOM:Element childNodes

Description

Access innerHTML on child node from element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/*from w w w  .j  a  v  a 2  s . c o m*/
console.log(document.getElementsByClassName('myClass')[0].childNodes[1].innerHTML);
    });

      </script> 
   </head> 
   <body> 
      <div id="myDiv"> 
         <h1 class="myClass"> 
            <a href="link">TEXT</a> 
         </h1> 
      </div>  
   </body>
</html>

Related Tutorials