HTML checked attribute

HTML checked attribute decides that which option should be checked initially in an option list.

<p>checked attribute gives default value to the input</p>
 <input type="radio" name="gender" value="Male">Male
 <input type="radio" name="gender" value="Female" checked>Female
 <input type="radio" name="gender" value="Other">Other
</>

checked attribute gives default value to the input

Male Female Other

Attribute values

All possible values of checked attribute

It is a boolean attribute. The presence of this attribute checks radio button or input option initially.

Related Tags

The tags that support checked attribute

<input> tag

input tags represents an input field in a form. checked attribute should be used when 'radio' or 'checkbox' are the types of input element.

<input type="checkbox" name="gender" value="Male">Male
<input type="checkbox" name="gender" value="Female" checked>Female
<input type="checkbox" name="gender" value="Other" >Other
Try</>


Was this article helpful?