Dialog close() method

Definition and usage

close() method to close the dialog.

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

See also:

HTML Reference Manual:HTML <dialog> Tag

Example

Display and close the dialog window:

var x = document.getElementById("myDialog"); 
function showDialog() { 
  x.show(); 
} 
function closeDialog() { 
  x.close(); 
}

Try It Yourself

Syntax

dialogObject.close()

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
37.0 Not Supported Not Supported 6.0 24.0