Details open Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Details


The open property sets or gets whether additional details/information should be visible to the user.

This property reflects the HTML open attribute.

Set the open property with the following Values

Value Description
true|false Sets whether additional details should be visible to the user
  • true - Details will be visible
  • false - Details will not be visible

Return Value

A Boolean, returns true if the details are visible, otherwise it returns false

The following code shows how to Show additional details:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<details id="myDetails">
  <summary>Copyright 2000-2018.</summary>
  <p> - by All Rights Reserved.</p>
  <p>All content and graphics on this web site are the property of the company</p>
</details>/* w  w w . j  ava2 s  .  co m*/

<button onclick="myFunction()">Test</button>

function myFunction() {
    document.getElementById("myDetails").open = true;


Related Tutorials