The DT object represents an HTML <dt> element.
We can access a <dt> element via document.getElementById()
:
var x = document.getElementById("myDT");
Click the button to get the HTML content of the dt element.
<!DOCTYPE html> <html> <body> <dl> <dt id="myDT">CSS</dt> <dd>to style web page</dd> </dl>//from w w w . j a va2 s .c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myDT").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>