Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Details open property

Details open property

Details Object Reference Details Object

Example

Show additional description information:

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

Try it »


Definition and Usage

The open property is used to set or return whether the information inside the details tag is visible to the user (open).

This property reflects the HTML open attribute.

When set to true, the content inside the details tag will be visible.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The open property is currently only supported by Opera, Chrome and Safari 6 browsers.


Syntax

Return the open property:

detailsObject

.open

Set the open property:

detailsObject

.open=true|false

Attribute values

Value Description
true|false Specifies that the details should be visible on the HTML page.
  • true - The description information is visible
  • false - The description information is not visible
  • |

    Technical Details

    Return Value: Boolean, returns true if the content of the details tag is visible, otherwise returns false.

    More examples

    Example

    Check whether the additional information in the details tag is visible:

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

    x The output result is:

    true

    Try it »

    Example

    Show or hide additional description information:

    function openDetails()

      {

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

      }

    function closeDetails()

      {

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

      }

    Try it »


    Details Object Reference Details Object