HTML DOM nodeName Property Last Updated : 09 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The nodeName property is used to return the name of the specified node as a string. It returns different values for different nodes such as if the node attributes, then the returned string is the attribute name, or if the node is an element, then the returned string is the tag name. It is a read-only property. Syntax: document.nodeName Return values: This property returns the name of the current node. The returned value is a string. For element nodes, the returned value is the tagname.For attribute nodes, the returned value is the name of the attributeFor document, comment, and text nodes, the returned value is "#document", "#comment" and "#text" respectively. Example: In this example, we will use the nodeName property HTML <!DOCTYPE html> <html> <head> <title> DOM nodeName Property </title> </head> <body onload="start ()" style="text-align: center"> <h1 style="color:green"> GeeksforGeeks </h1> <h2> DOM nodeName Property </h2> <div id="p"> Click to get the node name of this element. </div> <br> <button onclick="geek()">Click me!</button> <p id="p1"></p> <script> function geek() { let x = document.getElementById("p").nodeName; document.getElementById("p1").innerHTML = x; } </script> </body> </html> Output: Supported Browsers: The browser supported by nodeName property are listed below: Google Chrome 1 and aboveEdge 12 and aboveInternet Explorer 6 and aboveFirefox 1 and aboveOpera 12.1 and aboveSafari 1 and above Comment More infoAdvertise with us Next Article HTML DOM previousElementSibling Property V Vishal Chaudhary 2 Follow Improve Article Tags : Web Technologies HTML Web technologies HTML-DOM Similar Reads HTML DOM isContentEditable Property The DOM isContentEditable property is used to return a boolean where true means the content of an element is editable and false represents content is not editable. This property is read-only. Syntax: Object.isContentEditable Return Value: This property returns a boolean value. true means that the co 1 min read HTML DOM implementation Property The DOM implementation property in HTML is used to return the DOMImplementation object associated with the current document. The DOMImplementation is the interface that represents a method providing the object which is not dependent on any particular document. Syntax: document.implementation Return 2 min read HTML DOM specified Property The DOM specified property is used to return the boolean value. It returns true if the element has a specified attribute, otherwise, it returns a false value if the element does not have a specific attribute. Syntax:attribute.specifiedReturn value: It returns the boolean value which represents wheth 2 min read 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 Like