Dialog open Property

Dialog 对象参考手册Dialog Object

Examples

Open the dialog window:

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

Try it yourself »

Definition and Usage

The open property is used to set or return whether the dialog window is open.

This property reflects the <dialog> open attribute.

If this attribute is specified, it indicates that the dialog window is available and the user can interact with it.

Note:The <dialog> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Currently only Chrome Canary and Safari 6 browsers support the open property.

Note:Even though Chrome Canary supports the <dialog> element, you must open chrome://flags in the Chrome address bar and enable the "Enable experimental Web Platform features" flag. After enabling it, you need to restart the Chrome browser.

Syntax

Return the open property:

dialogObject.open

Set the open property:

dialogObject.open=true|false

Property Values

Value Description
true|false  Specifies whether the dialog window is open
  • true - The dialog window is open
  • false - Default. The dialog window is closed.

Technical Details

Return Value: A Boolean value, returns TRUE if the dialog window is open, otherwise returns FALSE.


More Examples

Example

Check whether the dialog window is open:

var x = document.getElementById("myDialog").open;
xThe output result is:
true

Try it yourself »


Related Articles

HTML Reference Manual:HTML <dialog> open Attribute


Dialog 对象参考手册Dialog Object

Other Extensions