typestar

Buttons in HTML

Three button types, and why type matters inside a form.

<form action="/api/results" method="post">
  <button type="submit">Save result</button>
  <button type="reset">Clear</button>
  <button type="button" id="retry">Try again</button>
  <button type="submit" disabled>Publishing...</button>
</form>

How it works

  1. submit is the default — state it anyway to be explicit.
  2. reset clears the form; button does nothing until scripted.
  3. disabled blocks the click and dims the control.

The run, in numbers

Lines
6
Characters to type
235
Tokens
61
Three-star pace
75 tpm

At the three-star pace of 75 tokens a minute, this run takes about 49 seconds.

Type this snippet

Step 4 of 5 in Validation & submission, step 22 of 25 in Forms & inputs.

← Previous Next →

Buttons in other languages