Latest web development tutorials

HTML DOM Dialog show () method

Dialog Object Reference Dialog Object

Examples

Display or close the dialog window:

var x = document.getElementById("myDialog");

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

function closeDialog()
{
x.close();
}

try it"

Definition and Usage

show () method is used to display the dialog window.

When this method is used to display a dialog window, the user can still interact with other elements of the page. If you do not want to allow users to interact with the page dialog window pops up, you can use showModal () 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 show () 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 .show()


Dialog Object Reference Dialog Object