×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Peter Hempel
Added: Sep 17, 2017 2:36 PM
Views: 8
how to go through different DOM "txt" nodes by innerHTML
  1. <h2>JavaScript HTML DOM</h2>
  2. <p>Hello World!</p>
  3. <p>Hello Norway!</p>
  4. <p id="demo"></p>
  5. <script>
  6. var myCollection = document.getElementsByTagName("p");
  7. document.getElementById("demo").innerHTML =
  8. "The innerHTML of the first paragraph is: " +
  9. myCollection[0].innerHTML;
  10. </script>