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:
<!DOCTYPE html> <html> <head> <title>HTML dd Tag</title> <style> h1 { color: green; } h1, h2 { text-align: center; } body { width: 70%; } dt { color: red; } </style> </head> <body> <h1>GeeksForGeeks</h1> <h2>DOM <dd> Object</h2> <dl> <dt>Geeks Classes</dt> <!-- Assigning id to dd --> <dd id="GFG"> It is an extensive classroom programme for enhancing DS and Algo concepts. </dd> <br> <dt>Fork Python</dt> <dd> It is a course designed for beginners in python. </dd> <br> <dt>Interview Preparation</dt> <dd> It is a course designed for preparation of interviews in top product based companies. </dd> </dl> <button onclick="myGeeks()"> Submit </button> <p id="sudo"> </p> <script> function myGeeks() { <!-- Accessing of dd object. --> var g = document.getElementById("GFG").innerHTML; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
Before Clicking On Button :

After Clicking On Button:

Example-2: DD Object can be created by using the document.createElement Method.
<!DOCTYPE html> <html> <head> <title>HTML dd Tag</title> <style> h1 { color: green; } h1, h2 { text-align: center; } body { width: 70%; } dt { color: red; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>DOM <dd> Object</h2> <button onclick="myGeeks()">Submit</button> <dl id="GFG"> <dt>Geeks Classes</dt> </dl> <script> function myGeeks() { var g = document.createElement("DD"); var f = document.createTextNode( "It is an extensive classroom for" + " enhancing DS and Algo concepts."); g.appendChild(f); var w = document.getElementById("GFG"); w.appendChild(g); } </script> </center> </body> </html> |
Output :
Before Clicking on Button:

After Clicking on Button:

Supported Browsers: The browser supported by DOM DD Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Object Object
- HTML | DOM Del Object
- HTML | DOM Kbd Object
- HTML | DOM Nav Object
- HTML DOM Aside Object
- HTML | Object tag
- HTML| DOM HR Object
- HTML | DOM Bdo Object
- HTML | DOM S Object
- HTML | DOM Map Object
- HTML | DOM Ul Object
- HTML | DOM Div Object
- HTML | DOM DFN Object
- HTML | DOM dl Object
- HTML | DOM Ol Object
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



