Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Dialog close() method

Dialog close() method

Dialog Object Reference Dialog Object

Example

Show and close the dialog window:

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

function showDialog()

  {

  x.show();

  }

function closeDialog()

  {

  x.close();

  }

Try it »


Definition and Usage

The close() method is used to close the dialog window.

Tip: This method is usually used together with show() the method.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note: Currently only Chrome Canary and Safari 6 browsers support the close() method.

Note: Even if Chrome Canary supports

element, you must open chrome://flags in the Chrome address bar and enable the "Enable experimental Web Platform features" flag. After enabling it, you need to restart the Chrome browser.


Syntax

dialogObject

.close()


Dialog Object Reference Dialog Object