Element nodeName Property - Get the node name of the <body> element: - Javascript DOM

Javascript examples for DOM:Element nodeName

Description

Element nodeName Property - Get the node name of the <body> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//  w w w .j  a v  a2  s. co  m
    var x = document.body.nodeName;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials