NodeList.item() (Method)

An item extractor to retrieve a Node from within a NodeList collection.

Availability:

DOM level - 1
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:Node object
JavaScript syntax:-myNodeList.item(anIndex)
Argument list:anIndexA numeric index to a Node in the collection

You should node that in MSIE, the Collection object has an Item() method whereas DOM mandates that a NodeList should have an item() method. Note the difference in the case of the initial letter.

Even though an implementation may forgive an upper-lower case error when it parses the script source text, an item() call on NodeList can only return a Node object referenced using an integer index location within the collection.

Because the NodeList is based on an Array, NodeList.item(anIndex) is functionally equivalent to NodeList[anIndex] and one can enumerate through the set of Node objects using either technique.