The checked attribute
The checked
attribute makes a checkbox checkbox
or a radio button radio
checked by default.
Is an attribute without a value.
Example . Checkboxes
In the following example, two checkboxes are created: the first one will be checked (since it is given the checked
attribute), and the second one will not:
<input type="checkbox" checked>
<input type="checkbox">
:
Example . Radio switches
Let's make two radio switches - the first one will be checked (since we'll give it the checked
attribute), and the second one won't:
<input type="radio" name="radio" checked>
<input type="radio" name="radio">
: