Details open Property - Toggle between opening and closing the additional details: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Details

Description

Details open Property - Toggle between opening and closing the additional details:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<details id="myDetails">
  <summary>Copyright 1999-2018.</summary>
  <p> - by java2s.com. All Rights Reserved.</p>
  <p>All content and graphics on this web site are the property of the company java2s.com.</p>
</details>//  ww  w  .j a v  a  2 s . com

<button onclick="openDetails()">Open details</button>
<button onclick="closeDetails()">Close details</button>

<script>
function openDetails() {
    document.getElementById("myDetails").open = true;
}

function closeDetails() {
    document.getElementById("myDetails").open = false;
}
</script>

</body>
</html>

Related Tutorials