Details openProperty

Details 对象参考手册Details Object

Example

Show additional description information:

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

Try it yourself »

Definition and Usage

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

This property reflects the HTML open attribute.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The open property currently only supports Opera, Chrome, and Safari 6 browsers.


Syntax

Return the open property:

detailsObject.open

Set the open property:

detailsObject.open=true|false

Property 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 value, returns true if the details tag content 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;

xThe output result is:

true

Try it yourself »

Example

Show or hide additional description information:

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

Try it yourself »


Details 对象参考手册Details Object

Other Extensions