Latest web development tutorials
 

HTML DOM Dialog Object


Dialog Object

The Dialog Object is new in HTML5.

The Dialog object represents an HTML <dialog> element.

Note: The <dialog> element is currently only supported in Chrome 37+, Safari 6+ and Opera 24+.

Access a Dialog Object

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

Example

var x = document.getElementById("myDialog");
Try it Yourself »

Create a Dialog Object

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

Example

var x = document.createElement("DIALOG");
Try it Yourself »

Dialog Object Properties

Property Description
open Sets or returns whether a dialog should be open or not
returnValue Sets or returns the dialog's return value

Dialog Object Methods

Method Description
close() Closes the dialog
show() Shows the dialog
showModal() Shows the dialog and makes it the top-most modal dialog

Standard Properties and Events

The Dialog object also supports the standard properties and events.


Related Pages

HTML reference: HTML <dialog> tag