Get Summary Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Summary


The Summary object represents an HTML <summary> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

  <summary id="mySummary">Copyright 2020-2030.</summary>
  <p> - by All Rights Reserved.</p>
</details>/*  w  ww .  j  a va2 s . co m*/

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

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

function myFunction() {
    var x = document.getElementById("mySummary").innerHTML;
    document.getElementById("demo").innerHTML = x;


Related Tutorials