HTML DOM item() Method Last Updated : 30 Aug, 2024 Comments Improve Suggest changes Like Article Like Report 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. Syntax:nodelist.item( index )ornodelist[ 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. Example: html <!DOCTYPE html> <html> <head> <title> HTML DOM item() Method </title> <!-- script to change node value --> <script> function changeElement() { var gfg = document.getElementById("geeks"); gfg.getElementsByTagName("P")[1].innerHTML = "Welcome to GeeksforGeeks!"; } </script> </head> <body> <center> <div id="geeks"> <h1 style="color:green;">GeeksforGeeks</h1> <p>A computer science portal</p> <p>DOM item() Method</p> </div> <button onclick="changeElement()"> Click Here! </button> </center> </body> </html> Output: Supported Browsers: The browser supported by DOM item() Method are listed below:Google ChromeEdge FirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML DOM item() Method S SoumyaNaraparaju Follow Improve Article Tags : JavaScript Similar Reads HTML DOM offsetLeft Property The DOM offsetLeft property is used to return the left position in pixels. This position is relative to the left side of the offsetParent element. Syntax: element.offsetLeft Return Value: It returns the number representing the left position of the element in pixels. Example: In this example, we will 1 min read HTML DOM previousElementSibling Property The previousElementSibling property in HTML DOM is used to return the previous element of the same level as the given element. If no previous element is found on the same level then it returns null. It is a read-only property. It is similar to the previousSibling property but the difference is previ 2 min read HTML DOM childElementCount Property The DOM childElementCount property is used to count the number of child elements and return it. It counts only child elements except for text and comment nodes. Syntax: node.childElementCount Where a node is an object which represents the document or element. Return Value: It returns the number of c 1 min read HTML DOM nextElementSibling Property The nextElementSibling property is used to return the immediate next element of the specified element, in the same tree level or null if the specified element is the last one in the list. It is a read-only property. It differs from the nextSibling property as nextSibling returns the next sibling nod 2 min read HTML DOM focus() Method DOM focus() method is used to give focus to an element and also to remove the focus with the help of blur() method. We can apply focus to any element and enable it by doing some operation. For example, we can give focus to some text by clicking a button. Syntax: Object.focus() Example-1: HTML <!D 1 min read HTML DOM innerHTML Property The innerHTML property sets or returns the HTML content (inner HTML) of an element. It allows you to manipulate the inner content, including HTML tags, by assigning new HTML strings or retrieving existing content, making it useful for dynamic updates on web pages.SyntaxIt returns the innerHTML Prope 2 min read HTML DOM firstChild Property The DOM firstChild Property is used to return the firstchild Node of its parent node element. It is read-only property and may return an element node, a text node or a comment node. Syntax:node.firstChild Return Value: It returns a string value which represent the first child of a node. If the eleme 2 min read HTML DOM parentNode Property The parentNode property is used to return the parent node of the specified node as a Node object. It is a read-only property. Syntax: node.parentNode Return value: This property returns a parent element of the specified node or null if the current node has no parent element. Example: In this example 2 min read HTML | DOM Abbreviation Object The DOM Abbreviation Object is used to represent the HTML <abbr> element. The abbreviation element is accessed by getElementById(). Example 1: html <!DOCTYPE html> <html> <head> <title> HTML DOM Abbreviation Object </title> <script> function myGeeks() { var 1 min read HTML | DOM Style margin Property The DOM Style margin Property is used to sets or returns the margin of an element.We can set the different size of margins for individual sides(top, right, bottom, left).Margin properties can have following values: Length in cm, px, pt, etc.Width % of the element.Margin calculated by the browser: au 2 min read Like