THE WORLD'S LARGEST WEB DEVELOPER SITE

Details open Property

❮ Details Object

Example

Show additional details:

document.getElementById("myDetails").open = true;
Try it Yourself »

Definition and Usage

The open property sets or returns whether additional details/information should be visible (open) to the user, or not.

This property reflects the HTML open attribute.

When set to true, the details will be visible (open) to the user.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
open 12.0 Not supported 49.0 6.0 15.0

Syntax

Return the open property:

detailsObject.open

Set the open property:

detailsObject.open=true|false

Property Values

Value Description
true|false Specifies whether additional details should be visible (open) to the user, or not
  • true - Details will be visible
  • false - Details will not be visible

Technical Details

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

More Examples

Example

Find out if additional details are visible (open) to the user, or not:

var x = document.getElementById("myDetails").open;

The result of x could be:

true
Try it Yourself »

Example

Toggle between opening and closing the additional details:

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

function closeDetails() {
    document.getElementById("myDetails").open = false;
}
Try it Yourself »

❮ Details Object