Lesson: HTML5 and CSS
Check Radio Buttons and Checkboxes by Default
You can set a checkbox or radio button to be checked by default using the checked
attribute.
To do this, just add the word "checked" to the inside of an input element. For example:
<input type="radio" name="test-name" checked>
Set the first of your radio buttons
and the first of your checkboxes
to both be checked by default.
The content on this page is licensed under Attribution-ShareAlike 4.0 International. Original authors: freeCodeCamp, the content was modified.