Dialog showModal() Method

❮ Dialog Object

Example

Show a dialog window:

document.getElementById("myDialog").showModal();
Try it Yourself »

Description

The showModal() method shows a modal dialog.

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

Note

When showModal() is used to show a dialog window, the user is not able to interact with other elements on the page.

if you want the user to be able to interact with other elements on the page while a dialog is shown, use the show() method instead.

See Also:

The show() Method

The close() Method

The Dialog Object

The HTML <dialog> Tag


Syntax

dialogObject.showModal()


Browser Support

showModal() has been supported in all browsers since HTML 4 (1997).

Chrome IE Edge Firefox Safari Opera
Yes 11 Yes Yes Yes Yes

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