typestar

Checkboxes in HTML

Independent on/off choices, each with its own name or a shared one.

<fieldset>
  <legend>Practice languages</legend>
  <label>
    <input type="checkbox" name="langs" value="python" checked>
    Python
  </label>
  <label>
    <input type="checkbox" name="langs" value="sql">
    SQL
  </label>
  <label>
    <input type="checkbox" name="quiet" value="1">
    Mute keystrokes
  </label>
</fieldset>

How it works

  1. checked sets the initial state.
  2. Sharing a name posts several values under that one key.
  3. An unchecked box is simply absent from the submission.

The run, in numbers

Lines
15
Characters to type
292
Tokens
76
Three-star pace
70 tpm

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

Type this snippet

Step 1 of 6 in Choices, step 9 of 25 in Forms & inputs.

← Previous Next →