Get DList Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:DList

Introduction

The DList object represents an HTML <dl> element.

You can access a <dl> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<dl id="myDL">
  <dt>CSS</dt>
  <dd>style</dd>
  <dt>HTML</dt>
  <dd>tag</dd>
</dl>/*from www  .java 2s.  c  om*/

<button onclick="myFunction()">get the HTML content of the dl element</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myDL").innerHTML;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials