Get the node type of the body element:
The result will be:
The nodeType property returns the node type, as a number, of the specified node.
If the node is an element node, the nodeType property will return 1.
If the node is an attribute node, the nodeType property will return 2.
Read more about node types in our Node Types reference.
![]()
The nodeType property is supported in all major browsers.
| Return Value: | A String, representing the node type of the node |
|---|---|
| DOM Version | Core Level 1 |
Node Object
Your message has been sent to W3Schools.