HTML | DOM Details open Property
The Details open property in HTML DOM is used to set or return whether the hidden information is visible or not to the user. This property is used to reflect the HTML open attribute.
Syntax:
- It returns the Details open property.
detailsObject.open
- It is used to set the Details open property.
detailsObject.open = true|false
Property Values: It accepts two property values which are listed below:
- true: It specifies the the hidden information should be visible.
- false: It specifies that the hidden information should not be visible.
Return Value: It returns a boolean value which represents that the hidden information would be visible or not.
Example 1: This example returns the Details open Property.
<!DOCTYPE html> <html> <head> <title> DOM details open Property </title> <style> h2 { color: green; font-size: 35px; } summary { font-size: 40px; color: #090; font-weight: bold; } </style> </head> <body> <center> <h2>DOM Details open Property </h2> <!-- assigning id to details tag. --> <details id="GFG"> <summary>GeeksforGeeks</summary> <p>A computer science portal for geeks</p> <div> It is a computer science portal where you can learn programming. </div> </details> <br> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { // Accessing details tag. var x = document.getElementById("GFG"); // Display hidden information // using open property. x.open = true; } </script> </center> </body> </html> |
Output:
Before Clicking on Button:

After Clicking on Button:

Example 2: This example sets the Details open Property.
<!DOCTYPE html> <html> <head> <title>DOM details open Property</title> <style> h2 { color: green; font-size: 35px; } summary { font-size: 40px; color: #090; font-weight: bold; } </style> </head> <body> <center> <h2>DOM Details open Property </h2> <!-- assigning id to details tag. --> <details id="GFG"> <summary>GeeksforGeeks</summary> <p>A computer science portal for geeks</p> <div>It is a computer science portal where you can learn programming.</div> </details> <br> <button onclick="myGeeks()">Submit</button> <p id="sudo" style="font-size:25px;"></p> <script> function myGeeks() { // Accessing details tag. var x = document.getElementById("GFG"); // Display hidden information // using open property. var g = x.open = false; document.getElementById("sudo").innerHTML = g; } </script> </center> </body> </html> |
Output :
Before Clicking on Button:

After Clicking on Button:

Supported Browsers: The browser supported by DOM Details open property are listed below:
- Google Chrome
- Internet Explorer 10.0 +
- Firefox
- Opera
- Safar
Recommended Posts:
- HTML | <details> open Attribute
- HTML | DOM Dialog open Property
- HTML | DOM Details Object
- HTML | DOM open() Method
- HTML | open Attribute
- HTML5 | <details> tag
- HTML | DOM URL Property
- HTML | DOM specified Property
- HTML | DOM value Property
- HTML | DOM Bdo dir Property
- HTML | DOM li value Property
- HTML | DOM dir Property
- HTML | DOM id Property
- HTML | DOM name Property
- HTML | DOM Meter value Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh



