The item() method is used to return the node at the specified index. The nodes are sorted as they appear in the source code. The index of the node list starts with 0.
nodelist.item( index )
nodelist[ index ]
Parameters: This method accepts single parameter index which is used to hold the index of node which need to return. It is required parameter and the index starts with 0.
Return Value: This method returns the node at specified index.
Before Click on the button:
After Click on the button:
Supported Browsers: The browser supported by DOM item() Method are listed below:
- Google Chrome
- Internet Explorer
- HTMLCollection item() Method
- CSSStyleDeclaration item() Method
- How to insert an item at the beginning of an array in PHP ?
- How to remove indentation from an unordered list item using CSS?
- Program to Insert new item in array on any position in PHP
- PHP program to add item at the beginning of associative array
- How to make the cursor to hand when a user hovers over a list item using CSS?
- HTML | DOM contains() Method
- HTML | DOM removeChild() Method
- HTML | DOM setNamedItem() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.