NodeList : Array

Collection of nodes accessible by index.

Browser/User Agent Support

IEMozillaNetscapeOperaSafariNetscapte
no1.0+7.0+nonono

Constructors

ConstructorIEMozillaNetscapeOperaSafariNetscapte
Collection of nodes accessible by index.
no1.0+7.0+nonono
 

Properties

PropertyIEMozillaNetscapeOperaSafariNetscapte
The number of nodes in this list.
no1.0+7.0+nonono
 

Methods

MethodIEMozillaNetscapeOperaSafariNetscapte
Returns the node contained at the specified index.
no1.0+7.0+nonono
 

Remarks

A NodeList is a sort of array which is used to contain a collection of nodes. It is commonly used throughout the DOM objects as a way of returning a list of nodes, whether as a listing of Node.attributes bound to an Element, or as a list of Node.childNodes.

Though in principle this object is similar to an Array, it is merely a very rudimentary form, and as such there is no relationship between the two objects. The list of methods and properties a NodeList supports is quite small in comparison.

References

NamedNodeMap

Availability

HTML DOM Level 1 | HTML DOM Level 2 | W3C

Constructor Detail

NodeList NodeList()

Collection of nodes accessible by index.

Visibility
internal

Property Detail

Number length - read only

The number of nodes in this list.

Remarks
Number of nodes contained within this NodeList. If no nodes are in this list, returns 0.
Availability

HTML DOM Level 1 | HTML DOM Level 2 | W3C

Method Detail

item(Number index) : static Node

Returns the node contained at the specified index.

NumberindexIndex number to retrieve.

Using item

for (var idx = 0; idx < node.Node.childNodes.length; idx++) {
                    var curNode = node.Node.childNodes.item(idx);
                    }

For more examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/item.html

Remarks
Returns the node contained within this NodeList at the given index number. The index values start counting at 0, and a null value will be returned if an invalid index is supplied.
Availability

HTML DOM Level 1 | HTML DOM Level 2 | W3C