Command Palette

Search for a command to run...

Hectal
Phase 2: Structure and Semantics
HTML · Exercise 5 of 6 PreviousNext
Intermediate

A delete confirmation dialog

Add a dialog that asks Delete this photo?. Inside it, use a <form method="dialog"> with two buttons: Cancel (value="cancel") and Delete (value="delete").

In JavaScript, clicking the Delete photo button must open the dialog as a modal.

When the dialog closes, set the text of #status to Deleted if its returnValue is delete, and to Kept otherwise.

What Check tests

  1. There is a dialog, closed when the page loads
  2. It has a form with method="dialog" and Cancel/Delete buttons
  3. Clicking Delete photo opens it as a modal
  4. Closing with delete shows Deleted
  5. Closing with cancel shows Kept

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.