Radio input elements are typically used in radio groups where only one button can be selected at a time. You can try out the radio button example to see how it works.
Additional attributes
In addition to the common attributes shared by all <input>
elements, radio
inputs support the following attributes.
checked
-
A Boolean attribute which, if present, indicates that this radio button is the default selected one in the group.
Unlike other browsers, Firefox by default persists the dynamic checked state of an
<input>
across page loads. Use theautocomplete
attribute to control this feature. value
-
The
value
attribute is one which all<input>
s share; however, it serves a special purpose for inputs of typeradio
: when a form is submitted, only radio buttons which are currently checked are submitted to the server, and the reported value is the value of thevalue
attribute. If thevalue
is not otherwise specified, it is the stringon
by default. This is demonstrated in the section Value above. required
-
The
required
attribute is one which most<input>
s share. If any radio button in a same-named group of radio buttons has therequired
attribute, a radio button in that group must be checked, although it doesn't have to be the one with the attribute applied.