HTML <input type="radio">
Radio buttons let a user select only one of a limited number of choices:
<input type="radio" id="css" name="fav_language" value="CSS">
Definition and Usage
<input type="radio"> defines a radio button.
Radio buttons are normally presented in radio groups (a collection of radio buttons describing a set of related options). Only one radio button in a group can be selected at the same time.
Note: The radio group must share the same name (the
value of the
name attribute) to be treated as a group. Once the radio group is
created, selecting any radio button in that group automatically deselects any
other selected radio button in the same group. You can have as many radio groups
on a page as you want, as long as each group has its own name.
value attribute defines the unique value
associated with each radio button. The value is not shown to the user, but is
the value that is sent to the server on "submit" to identify which radio button
that was selected.
Tip: Always add the
for best accessibility practices!