Dialog show() Method

❮ Dialog Object

Example

Show and close a dialog window:

const dialog = document.getElementById("myDialog");

function showDialog() {
  dialog.show();
}

function closeDialog() {
  dialog.close();
}
Try it Yourself »

Description

The show() method shows an HTML <dialog> object.

The show() method is often used together with the close() method.

Note

When the show() method is used to show a dialog window, the user can still interact with other elements on the page.

If you want the user to only interact with the dialog, use the showModal() method.

See Also:

The close() Method

The showModal() Method

The Dialog Object

The HTML <dialog> Tag


Syntax

dialogObject.show()

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.