HTML DOM nodeName Property
Example
Get the node name of the body element:
document.body.nodeName;
Output result:
BODY
Try it »
Definition and Usage
The nodeName property returns the name based on the type of the node.
If the node is an element node, the nodeName property returns the tag name.
If the node is an attribute node, the nodeName property returns the attribute name.
For other node types, the nodeName property returns different node names depending on the node type.
Browser support





All major browsers support the nodeName property
Syntax
node
.nodeName
Technical Details
| Return Value: | String, representing the name of the node. |
|---|---|
| DOM version | Core Level 1 Node Object |
Element object