Latest web development tutorials

HTML DOM Dialog showModal () method

Dialog Object Reference Dialog Object

Examples

Display the dialog box:

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

try it"

Definition and Usage

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

When this method is used to display a dialog window, and the user can not interact with other elements of the page. If you want the user can still interact with the page in the dialogue window pops up, you can use the show () method.

Tip: This method is usually close () method be used together.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note: Currently, only Chrome Canary, Safari 6 browser supports showModal () method.

Note: Even if Chrome Canary Support <dialog> element, you must open in the Chrome address bar chrome: // flags and turn "Enable experimental Web Platform features" tag. After the turn, you need to restart the Chrome browser.


grammar

dialogObject .showModal()


Dialog Object Reference Dialog Object