Definition and Usage The checked attribute specifies if the input is pre-checked (pre selected "on"). This attribute is only use...
Definition and Usage
The checked attribute specifies if the input is pre-checked (pre selected "on").This attribute is only used if the type attribute of the input element is set to "checkbox" or "radio".
This attribute is useful for preselecting inputs in a form, or preserving the state of a form selection.
Syntax
<input checked="checked" /> |
Attribute Values
Value | Description |
---|---|
checked | Specifies that the checkbox or radio button is checked. |
Browser Support
The attribute is supported in all major browsers.
Example
Source | Output |
---|---|
<form action=""> Checked checkbox: <input type="checkbox" name="cbox" id="cbox" checked="checked" /> </form> |