← CodePrimer
HTML Beginner Forms

Radio button group

How do I let users pick only one option?

Shared name groups radios.

Sample
<fieldset>
  <legend>Year level</legend>
  <label><input type="radio" name="year" value="1" required> 1st</label>
  <label><input type="radio" name="year" value="2"> 2nd</label>
  <label><input type="radio" name="year" value="3"> 3rd</label>
</fieldset>

Notes

Same name makes the choice exclusive.

Keywords: radio · form · choice

Related

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share