Node.nodeType (Property)

The nodes are created for a variety of purposes. This property indicates what sort of node has been instantiated.

Availability:

DOM level - 1
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:Number primitive
JavaScript syntax:-myNode.nodeType

The values in this parameter correspond to the values of the Static Constants belonging to the Node Class.

Here is a list of the available node types:

ConstantTypeDescription
undefinednullA member of the attributes collection
ELEMENT_NODE1HTML element object node
ATTRIBUTE_NODE2HTML tag attribute object
TEXT_NODE3Text object node
CDATA_SECTION_NODE4CDATA section
ENTITY_REFERENCE_NODE5Entity reference
ENTITY_NODE6Entity node
PROCESSING_INSTRUCTION_NODE7Processing instruction node
COMMENT_NODE8Comment node
DOCUMENT_NODE9Document object
DOCUMENT_TYPE_NODE10Doctype object
DOCUMENT_FRAGMENT_NODE11Document fragment node
NOTATION_NODE12Notation node

See also:Element.nodeType