Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Dialog showModal() method

Dialog showModal() method

Dialog Object Reference Dialog Object

Example

Display the dialog window:

document.getElementById("myDialog").showModal();

Try it »


Definition and Usage

The showModal() method is used to display the dialog window (shows the dialog).

When this method is used to display the dialog window, the user cannot interact with other elements on the page. If you want the user to still be able to interact with the page while the dialog is shown, you can use the show() method.

**Tip:** This method is usually used together with close() the method.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note: Currently only Chrome Canary and Safari 6 browsers support the showModal() method.

Note: Even if Chrome Canary supports

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

dialogObject

.showModal()


Dialog Object Reference Dialog Object