Javascript examples for DOM:Element nodeName
Element nodeName Property - Get the node types of the <body> element's child nodes:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <!-- My personal comment goes here.. --> <p id="demo"></p> <script> function myFunction() {/*w w w. ja va 2 s . c om*/ var c = document.body.childNodes; var txt = ""; var i; for (i = 0; i < c.length; i++) { txt = txt + c[i].nodeType + "<br>"; } document.getElementById("demo").innerHTML = txt; } </script> </body> </html>