HTML DOM Code Object Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The DOM Code Object is used to represent the HTML <code> element. The Code element is accessed by getElementById(). Syntax: document.getElementById("id"); Where 'id' is the ID assigned to the code tag. Example 1: In this example, we will use DOM Code Object HTML <!DOCTYPE html> <html> <body> <h1 style="color:green; font-size:38px;"> GeeksForGeeks </h1> <h2>DOM code Object</h2> <!-- Assign id to CODE tag--> <code id="GFG"> GeeksForGeeks: A computer science portal for geeks. </code> <br> <br> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { let g = document.getElementById("GFG"); <!--Change the color of code element.--> g.style.color = "coral"; } </script> </body> </html> Output: Example 2: Code Object can be created by using the document.createElement method. HTML <!DOCTYPE html> <html> <body> <h1 style="color:green; font-size:38px;"> GeeksForGeeks </h1> <h2>DOM code Object</h2> <br> <button onclick="myGeeks()">Submit</button> <script> <!--Creating code element--> function myGeeks() { let g = document.createElement("CODE"); let f = document.createTextNode("GeeksForGeeks:" + "A computer science portal for geeks."); g.appendChild(f); document.body.appendChild(g); } </script> </body> </html> Output: Supported Browsers: The browser supported by DOM Code Object are listed below: Google ChromeInternet ExplorerFirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML DOM Style borderBottomStyle Property M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML Web technologies HTML-DOM +1 More Practice Tags : Misc Similar Reads HTML DOM Style borderColor Property The DOM Style borderColor property specifies the color of the element's border. It may be given explicitly, inherit from the parent or by default it will take the default value. Syntax: To get the border color property:object.style.borderColorTo set the border color property:object.style.borderColor 3 min read HTML DOM Style borderBottomStyle Property The style borderBottomStyle property in HTML DOM is used to set or return the style of the bottom border of an element. Syntax: It returns the style of the bottom border.object.style.borderBottomStyleIt sets the style of the bottom border.border-bottom-style: value; Property Values: none: It is the 2 min read HTML DOM Del Object The Del Object in HTML DOM is used to represent the HTML <del> element. The <del> element can be accessed by getElementById(). Object Properties: cite: It is used to set or return the value of the cite attribute of a deleted element.dateTime: It is used to sets or return the value of the 2 min read HTML DOM removeAttribute() Method The DOM removeAttribute() method is used to remove an attribute with specified name from the element. It is similar to the removeAttributeNode() method but the difference is that the removeAttributeNode method is used to remove the specified attribute object, but on the other hand, removeAttribute r 1 min read HTML DOM DD Object The DOM DD Object is used to represent the HTML <DD> element. The DD element is accessed by getElementById(). Syntax: document.getElementById("ID"); Where âidâ is the ID assigned to the âddâ tag. Example 1: In this example, we will use DOM DD Object. HTML <!DOCTYPE html> <html> 2 min read HTML DOM Style backgroundClip Property The DOM style backgroundClip Property is used to set or return the painting area of the background. Syntax: It is used to return the backgroundClip property.object.style.backgroundClip It is used to set the backgroundClip property. object.style.backgroundClip = "border-box|padding-box|content-box|in 1 min read HTML DOM setAttributeNode() Method The setAttributeNode() method in HTML DOM is used to add the specified attribute node to an element. If the specified attribute is already present, then this method replaces it. Syntax: element.setAttributeNode(name) Parameter: Only one parameter is accepted name.Where the name is the attribute node 1 min read HTML DOM BR Object The DOM BR Object is used to represent the HTML <br> element. The br element is accessed by getElementById(). Syntax: document.getElementById(id) Where "id" is the ID assigned to the br tag. Property: clear: It is used to Sets or return the flow of text around floating objects Example 1: In th 2 min read HTML DOM className Property In the HTML document, the className property is used to set or return the value of an elementâs class attribute. Using this property, the user can change the class of an element to the desired class. Syntax: returns the className propertyHTMLElementObject.className;sets the className propertyHTMLEle 3 min read HTML DOM Location reload() Method The location reload() method in HTML DOM is used to reload the current document. This method refreshes the current documents. It is similar to the refresh button in the browser. Note: It does not return any value. Syntax:location.reload( forceGet )Parameters: It does not take any parameters Exampl 1 min read Like