GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — HTMLDialogElement: show() method - Web APIs | MDN

HTMLDialogElement: show() method

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.

  • See full compatibility
  • Learn more

The show() method of the HTMLDialogElement interface displays the dialog as a non-modal dialog.

A non-modal dialog is one where users can interact with content outside/behind the open dialog.

Syntax

js
show()

Parameters

None.

Return value

None (undefined).

Exceptions

InvalidStateError DOMException

Thrown if the dialog is already open and modal (i.e., if the dialog has already been opened with HTMLDialogElement.showModal()).

Examples

Basic usage

The following example shows a simple button that, when clicked, opens a <dialog> using the show() method.

When the dialog is open, you can still interact with the rest of the page, including clicking the Click me button that triggers an alert.

You can click the Close dialog button to close the dialog (via the close() method).

HTML

html
<dialog id="dialog">
  <button type="button" id="close">Close dialog</button>
</dialog>

<p><button id="open">Open dialog</button></p>
<p><button id="alert">Trigger alert</button></p>

JavaScript

js
const dialog = document.getElementById("dialog");
const openButton = document.getElementById("open");
const closeButton = document.getElementById("close");
const alertButton = document.getElementById("alert");

// Open button opens a modeless dialog
openButton.addEventListener("click", () => {
  dialog.show();
});

// Alert button triggers an alert
alertButton.addEventListener("click", () => {
  alert("you clicked me!");
});

// Close button closes the dialog box
closeButton.addEventListener("click", () => {
  dialog.close();
});

Result

Specifications

Specification
HTML
# dom-dialog-show-dev

Browser compatibility

See also

  • HTML <dialog> element
  • HTMLDialogElement.showModal()

Help improve MDN

Learn how to contribute

This page was last modified on Jan 26, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.