Dialog open Property

❮ Dialog Object

Example

Open a dialog window:

document.getElementById("myDialog").open = true;
Try it Yourself »

Description

The open property sets or returns whether a dialog should be open or not.

This property reflects the <dialog> open attribute.

When present, it specifies that the dialog element is active and that the user can interact with it.



Syntax

Return the open property:

dialogObject.open

Set the open property:

dialogObject.open = true|false

Property Values

Value Description
true|false  Specifies whether a dialog window should be open or not
  • true - The dialog window is open
  • false - Default. The dialog window is not open

Technical Details

Return Value: A Boolean, returns true if the dialog window is open, otherwise it returns false

More Examples

Example

Find out if a dialog window is open:

let x = document.getElementById("myDialog").open;
Try it Yourself »

Related Pages

HTML reference: HTML <dialog> open attribute


Browser Support

<dialog> was introduced in HTML 5 (2014).

It is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

<dialog> is not supported in Internet Explorer 11 (or earlier).


❮ Dialog Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.