HTML 5 · Text, links and media

Create a modal dialog

Use the built-in dialog element. Call showModal() to open it and close() to close it.

<dialog id="confirm">
  <p>Are you sure?</p>
  <form method="dialog"><button>OK</button></form>
</dialog>

Official HTML 5 documentation

More text, links and media commands

All text, links and media commands · HTML 5 cheatsheet

Was this page helpful?