Easy Tutorial
❮ Prop Documenttype Entities Prop Element Parentnode ❯

XML DOM nodeType Property



Definition and Usage

The nodeType property returns the node type of the selected node.

Syntax

Node Type: Node Name:
1 Element
2 Attribute
3 Text
4 CDATA Section
5 Entity Reference
6 Entity
7 Processing Instruction
8 Comment
9 Document
10 Document Type
11 Document Fragment
12 Notation

Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc and retrieves the node type of the first <title> element:

Example

The above code will output:


Try It

nodeType - Ignore empty text nodes


❮ Prop Documenttype Entities Prop Element Parentnode ❯