Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>The Element Object</h1> <h2>The nodeName, nodetype, and nodeValue Properties</h2> <div id="myDIV">This is "myDIV".</div> <p>Node name, type and value of "myDIV"s first child is:</p> <p id="demo"></p> <script> const x = document.getElementById("myDIV").firstChild; let text = ""; text += "Name: " + x.nodeName + "<br>"; text += "Value: " + x.nodeValue + "<br>"; text += "Type: " + x.nodeType; document.getElementById("demo").innerHTML = text; </script> </body> </html>