HTML DOM Dialog Object

Dialog Object

The Dialog object is a new object in HTML5.

The Dialog object represents the HTML <dialog> element.

Note:Currently only Chrome Canary and Safari 6 support the <dialog> element.

Access Dialog Object

You can access the <dialog> element by using getElementById():

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

Try it yourself

Create Dialog Object

You can create a <dialog> element by using the document.createElement() method:

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

Try it yourself

Dialog Object Properties

Properties Description
open Set or return whether the dialog is open.
returnValue Set or return the dialog's return value.

Dialog Object Methods

Method Description
close() Close the dialog.
show() Display the dialog.
showModal() Displays the dialog and makes it the top-most dialog.

Standard Properties and Events

Dialog Object Supports StandardsPropertiesAndEvents.

Related Pages

HTML Reference Manual:HTML <dialog> Tag