HTML DOM Dialog object

Dialog object

The Dialog object is new in HTML5.image.png

A Dialog object represents an HTML <dialog> element.

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

Access the Dialog object

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

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

 Try It! 

Create a Dialog object

You can create <dialog> elements using the document.createElement() method:

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

 Try It! 

Dialog object attributes

openSet or return whether the dialog window is open
returnValueSet or return the dialog's return value

Dialog object methods

close()Close the dialog window
show()Display a dialog
showModal()Show the dialog and make it the topmost dialog

Standard Properties and Events

Dialog objects also support standard properties and events .

Related articles

HTML Reference Manual: HTML <dialog> Tag