Details open attribute

Definition and usage

open attribute settings or returns whether additional detail/information should be visible to the user (open).

This attribute reflects <details> open attribute.

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

See also:

Εγχειρίδιο HTML:Ετικέτα HTML <details>

Example

Example 1

Display additional detail information:

document.getElementById("myDetails").open = true;

Try it yourself

Example 2

Understand whether the user can see (open) additional detail information:

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

Try it yourself

Example 2

Toggle between opening and closing additional detail information:

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

Try it yourself

Syntax

Return the open attribute:

detailsObject.open

Set the open attribute:

detailsObject.open = true|false

Attribute value

Value Description
true|false

Specify whether the additional detail information should be visible to the user (open).

  • true - The detail information will be visible
  • false - The detail information will not be visible

Τεχνικές λεπτομέρειες

Αποτελέσματα επιστροφής: Βολικότητα, επιστρέφει true αν οι λεπτομέρειες είναι ορατές, αλλιώς επιστρέφει false.

Υποστήριξη του προγράμματος περιήγησης

Τα αριθμήματα στη τаблицή δείχνουν την έκδοση του προγράμματος περιήγησης που υποστηρίζει πλήρως την ιδιότητα.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
12.0 Μη υποστηριζόμενο 49.0 6.0 15.0

Σχετικές σελίδες

Εγχειρίδιο HTML:Αξία open στο HTML <details>