HTML DOM attributes Property Last Updated : 13 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The attributes property in HTML DOM returns the group of node attributes specified by NamedNodeMap objects. The NamedNodeMap object represents the collection of attribute objects and can be accessed by index number. The index number starts at 0. Syntax: node.attributes Return Value: It returns the NamedNodeMap object which is the collection of nodes. Note: In Internet Explorer 8 and earlier versions, the attributes property will return a collection of all possible attributes for an element that can result in higher value than expected. Example 1: html <!DOCTYPE html> <html> <head> <title> HTML DOM attributes Property </title> </head> <body> <!-- Setting up an image --> <img id = "GFG" src = "https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png" > <br> <button onclick = "myGeeks()"> DOM attributes property </button> <p id = "demo"></p> <script> function myGeeks() { // It returns the number of nodes var x = document.getElementById("GFG").attributes.length; // Display the number of nodes document.getElementById("demo").innerHTML = x; } </script> </body> </html> Output: Example 2: html <!DOCTYPE html> <html> <head> <title> HTML DOM attributes Property </title> </head> <body> <h2> HTML DOM attributes Property </h2> <button id="GFG" onclick="myGeeks()"> Click Here! </button> <br> <br> <span> Button element attributes: </span> <span id="sudo"></span> <script> function myGeeks() { // It returns the number of nodes var gfg = document.getElementById("GFG").attributes.length; // Display the number of nodes document.getElementById("sudo").innerHTML = gfg; } </script> </body> </html> Output: Supported browsers The browser supported by DOM attributes property are listed below: Google Chrome 1 and aboveEdge 12 and aboveInternet Explorer 5.5 and aboveFirefox 1 and aboveOpera 8 and aboveApple Safari 1 and above Comment More infoAdvertise with us A abhishek7 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM Style borderImage Property The DOM Style borderImage Property in HTML is a shorthand property used for setting the borderImageSource, borderImageSlice, borderImageWidth,borderImageOutset, and borderImageRepeat properties. Syntax: It is used to return the borderImage property. object.style.borderImageIt is used to set the bord 2 min read HTML DOM stopPropagation() Event Method The stopPropagation() method is used to stop the propagation of event calling. That is a parent event is called we can stop the propagation of calling its children by using the stopPropagation() method and vice-versa. Syntax: event.stopPropagation() Return Value: It does not return any value. Exampl 2 min read HTML DOM Emphasized Object The HTML DOM Emphasized object represents the <em> element, used to emphasize text, typically rendering it in italics. It can be accessed and manipulated through JavaScript to alter its content or styling.Syntax:document.getElementById("ID");Example: Clicking the "Submit" button changes the em 1 min read HTML DOM type Event Property The type event property in HTML DOM is used to return the type of the triggered event. It returns a string that represents the type of the event. The events can be keyboard events or mouse events. Syntax: event.type Return Value: It returns a string that represents the type of event. Example: In thi 1 min read HTML DOM timeStamp Event Property The timeStamp property in the HTML DOM refers to a read-only property that returns the time (in milliseconds) at which an event was created. The value is measured relative to the UNIX epoch (January 1, 1970, 00:00:00 UTC). This property is commonly used to determine the timing of events and can be u 1 min read HTML | DOM Details Object The DOM Details Object is used to represent the HTML <details> element. The Details element is accessed by getElementById(). Properties: open: The details tag has an attribute called 'open' which is used to display the hidden information by default. Syntax: document.getElementById("ID"); Where 2 min read HTML DOM cancelable Event Property The cancelable event property indicates whether the event's default action can be prevented. If the value is true, the default action can be prevented using event.preventDefault(). If false, the default action cannot be prevented. It is a read-only property.It is a read-only boolean property.Syntax: 1 min read HTML DOM Style borderImageRepeat Property The borderImageRepeat style property in HTML DOM is used to set or return the borderImageRepeat property. It specifies whether the border image should repeat to fill the area, stretched to fill the area, set to the initial value, inherit property from its parent, etc. Depending on the need it will b 4 min read HTML | DOM Style borderImageOutset Property In the Style borderImageOutset Space which contains the border, image is to be painted is called the border-image space. By default, the boundaries of the border image area match with the boundaries of the elementâs border-box. However, these boundaries can be extended using the border-image-outset 4 min read HTML | DOM Figcaption Object The Figcaption Object in HTML DOM is used to represent the HTML <figcaption> element. The figcaption element is accessed by getElementById(). Syntax: document.getElementById("ID"); Where ID represent the element id. Example 1: html <!DOCTYPE html> <html> <head> <title> 2 min read Like