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

Property
open Yes Not supported Not supported Yes Yes

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").disabled;

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