Element.nodeType (Property)

Part of the internal document hierarchy management.


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

The nodeType property is part of the browser's internal DOM management.

By inspecting the properties of various objects with an enumeration loop, you can determine some values for this property. If you know the node type, you may be able to take advantage of this when you write more sophisticated scripts. Here is a partial list of node types defined by the DOM specification:

undefinednullA member of the attributes collection
ELEMENT_NODE1HTML element object node
ATTRIBUTE_NODE2HTML tag attribute object
TEXT_NODE3Text object node
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

The DOM standard is quite large at level 1 and defines a lot of ways in which you can traverse a document structure. The level 2 capabilities are even more extensive. Scripts than can understand node types and DOM document trees will be able to accomplish some amazingly powerful things.

See also:Element object, Node.nodeType

Property attributes: