The DD (definition description) object represents an HTML <dd> element and can be retrieve using by document method getElementById(). It can be created by using document method createElement().
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <h1>The DD Object</h1>
5 <h2>Example</h2>
6
7 <dl>
8 <dt>Heading</dt>
9 <dd id="dd">Description of the heading</dd>
10 </dl>
11 <button onclick="apply()">Check</button>
12 <p id="result"></b>
13 <script>
14 function apply() {
15 const element = document.getElementById("dd");
16 const str = `Text of DD element : <b>${element.innerHTML}</b>`;
17 document.getElementById("result").innerHTML = str;
18 }
19 </script>
20 </body>
21 </html>
DD Object
Create DD object dynamically
Create DD object dynamically
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <h1>The DD object</h1>
5 <h2>Example</h2>
6
7 <dl id="dl">
8 <dt>Heading</dt>
9 </dl>
10 <button onclick="apply()">Add DD</button>
11 <p id="result"></b>
12 <script>
13 function apply() {
14 const element = document.createElement("DD");
15 const text = document.createTextNode("Description of the heading");
16 element.appendChild(text);
17 document.getElementById("dl").appendChild(element);
18 }
19 </script>
20 </body>
21 </html>
Create DD object dynamically
Standard Properties and Events for DD object
The Element object represents an HTML element that can be P, DIV, A, TABLE, or any other HTML element. It provides many methods and properties that can be used to retrieve information and perform operation on element.
The JavaScript provides many Events object that are inherited from Event object and provides specific types of event object.
Related options for your search