X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM item() Method

Element Object Reference Element Object

Example

Return the first child node of an element:

document.body.childNodes.item(0);

Try it yourself »


Definition and Usage

The item() method returns the node at the specified index in a node lists.

This syntax:

document.body.childNodes.item(0);

Will produce the same result as this syntax:

document.body.childNodes[0];

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The item() method is supported in all major browsers.


Syntax

nodelist.item(index)

Parameters

Parameter Type Description
index Number Required. The index of the node you want to return, in the node list

Return Value

Type Description
Node object The node at the specified index

Technical Details

DOM Version Core Level 1 Nodelist Object


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook