HTMLCollection item() Method Last Updated : 10 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The item() method is used to return the content of element at the given index of the collection of all HTML element. The index starts from zero(0). The elements in the collection are sorted in the order as they appear in the sourcecode. Syntax: HTMLCollection.item(index) OR HTMLCollection[index] Parameters: It contains a number that represents the index of the element that the user wants to return. The index starts from 0. Example-1: html <!DOCTYPE html> <html> <head> <style> h1 { color: green; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>HTMLCollection item() Method</h2> <button onclick="Geeks()">Submit</button> <script> function Geeks() { var w = document.getElementsByTagName("h1"); alert(w.item(0).innerHTML); } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: Example-2: To change the content of an HTML Element. html <!DOCTYPE html> <html> <head> <style> h1 { color: green; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>HTMLCollection item() Method</h2> <p>geeforgeefs</p> <button onclick="Geeks()">Submit</button> <script> function Geeks() { document.getElementsByTagName("P")[0].innerHTML = "GeeksForGeeks"; } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: Supported Browsers: The browser supported by HTMLCollection item() Method are listed below: Google Chrome 1Edge 12Internet Explorer 8Firefox 1Opera 12.1Safari 1 Comment More infoAdvertise with us Next Article HTMLCollection item() Method M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML HTML-Methods Practice Tags : Misc Similar Reads HTML DOM Table tBodies Collection The Table tBodies collection is used for returning the collection of all the <tbody> elements in a table. The sequence of the <body> elements are sorted in the same way as their position in the source code. Syntax:tableObject.tBodiesProperties:length: It returns the number of <tbody 2 min read HTML Collection for Loop An HTMLCollection for loop is used to iterate over a collection of HTML elements, like those returned by getElementsByTagName() or getElementsByClassName(). Use a for loop, for...of the loop, or convert the collection to an array with Array.from() for easy iteration.Note: It is not recommended to us 4 min read HTML DOM forms Collection The DOM forms collection is used to return the collection of all <form> elements in a HTML document. The form elements are sorted as they appear in the source code. Syntax: document.forms Properties: It returns the number of form in the collection of elements. Methods: The DOM forms collection 4 min read Nested List in HTML A nested list in HTML is a list that contains other lists within its list items. This creates a hierarchical structure, where each sublist is indented to visually represent its relationship to the parent list item. 1. Nested Unordered List in HTMLAn unordered list in HTML is a collection of items re 1 min read HTML DOM Form elements Collection The Form element collection in HTML DOM is used to set or return the collection of all <input> elements inside a form element. The <input> elements are sorted as they appear in the source code. Syntax: formObject.elements Properties: It returns a number of input elements inside the <f 2 min read Like