Elements – Dialog Tag

Dialog Tag

The <dialog> tag defines a dialog box or window.

The <dialog> element makes it easy to create popup dialogs and modals on a web page.

The <dialog> tag is new in HTML5.


Indicates that the dialog is active and that the user can interact with it.
When the open attribute is not set, the dialog shouldn’t be shown to the user.


<dialog open> <p>This is an open dialog window</p> </dialog>

HTML DOM Dialog Object

To access a element by using getElementById():

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

Create a Dialog Object:

var x = document.createElement("DIALOG");

Dialog Object Methods:

close() – Closes the dialog

show() – Shows the dialog

showModal() – Shows the dialog and makes it the top-most modal dialog

Further reading:


This article needs improvement. You can help improve this article. You can also write similar articles and help the community.