Details open Property - check if additional details are visible to the user - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Details

Description

Details open Property - check if additional details are visible to the user

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>//from  w  w w.  j av  a 2  s  .  co  m

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

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

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

</body>
</html>

Related Tutorials