Dialog open Attribute
Example
Open the dialog window:
document.getElementById("myDialog").open = true;
Definition and Usage
The open attribute is used to set or return whether the dialog window is open.
This attribute reflects the <dialog> open attribute.
If this attribute is specified, it indicates that the dialog window is available for interaction.
Note: The <dialog> element is new in HTML5.
Browser Support
Note: Currently, only Chrome Canary and Safari 6 support the open attribute.
Note: Even if Chrome Canary supports the <dialog> element, you must enable the "Enable experimental Web Platform features" flag in the Chrome address bar by opening chrome://flags. After enabling, you need to restart Chrome.
Syntax
Return the open attribute:
Set the open attribute:
Attribute 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: | Boolean, returns TRUE if the dialog window is open, otherwise returns FALSE. | | --- | --- |
More Examples
Example
Check if the dialog window is open:
var x = document.getElementById("myDialog").open;
true
Related Articles
HTML Reference: HTML <dialog> open Attribute