A question with one answer

Ask one question with three possible answers.

What to build

A named group of three radio buttons.

Requirements

  • A fieldset with a legend reading Delivery.
  • Three radio inputs with name="delivery" and the values pickup, bike and post.
  • Each has a joined label: Pick up, By bike, By post.
  • pickup is chosen from the start.

Constraints

Use exactly three inputs and one fieldset.

Example

<input type="radio" name="delivery" value="bike">

Why it works

The shared name makes them one group, so that only one can be chosen, and the values make the choice meaningful to the server.

Hints

Hint 1

Give all three radio buttons the same name.

Hint 2

Each needs a different value.

Solution

Show one correct solution (try it yourself first)
<form>
  <fieldset>
    <legend>Delivery</legend>
    <input type="radio" id="d1" name="delivery" value="pickup" checked>
    <label for="d1">Pick up</label>
    <input type="radio" id="d2" name="delivery" value="bike">
    <label for="d2">By bike</label>
    <input type="radio" id="d3" name="delivery" value="post">
    <label for="d3">By post</label>
  </fieldset>
</form>

Lesson: The right control for each question →