nodeType

The nodeType JS Node returns a number appropriate for the type of node.

Type Description Number
Element Node.ELEMENT_NODE 1
Attr Node.ATTRIBUTE_NODE 2
An exclusive Text node Node.TEXT_NODE 3
CDATASection Node.CDATA_SECTION_NODE 4
ProcessingInstruction Node.PROCESSING_INSTRUCTION_NODE 7
Comment Node.COMMENT_NODE 8
Document Node.DOCUMENT_NODE 9
DocumentType Node.DOCUMENT_TYPE_NODE 10
DocumentFragment Node.DOCUMENT_FRAGMENT_NODE 11

Syntax

node.nodeType

Examples

1 · Element

2 · Attr

3 · Text

4 · CDATASection

5 · ProcessingInstruction

6 · Comment

7 · Document

8 · DocumentType

9 · DocumentFragment

nodeName

baseURI

childNodes

cloneNode

compareDocumentPosition

contains

firstChild

getRootNode

hasChildNodes

isConnected

isEqualNode

lastChild

nextSibling

nodeName

normalize

ownerDocument

parentElement

parentNode

previousSibling

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu