HTML DOM Element nodeType
HTML DOM Element nodeType Property
The nodeType property is a read-only property and it returns the node type of the specified node in the form of the number.
- If the returned number is "1" then the node is an element node.
- If the returned number is "2" then the node is an attribute node.
- If the returned number is "3" then the node is a text node.
- If the returned number is "8" then the node is a comment node.
Syntax:-
Its syntax is:- node.nodeType
Return:-
Its return is:- node type of the node in number
Further Explanation:-
Type | Named Constant |
---|---|
1 | ELEMENT_NODE |
2 | ATTRIBUTE_NODE |
3 | TEXT_NODE |
4 | CDATA_SECTION_NODE |
5 | ENTITY_REFERENCE_NODE |
6 | ENTITY_NODE |
7 | PROCESSING_INSTRUCTION_NODE |
8 | COMMENT_NODE |
9 | DOCUMENT_NODE |
10 | DOCUMENT_TYPE_NODE |
11 | DOCUMENT_FRAGMENT_NODE |
12 | NOTATION_NODE |