Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> checked Attribute

The checked attribute on an <input> tag checks (selects) a checkbox or a radio button element.

Clicking the input element will also toggle the check state.

Example

#

A checked attribute on an <input> element.
The third checkbox is checked (selected).





<form action="/tutorial/action.html">
  <label>Select Colors </label><br />
  <input type="checkbox" id="color-red" name="color" value="Red">
  <label for="color-red">Red</label><br />
  <input type="checkbox" id="color-green" name="color" value="Green">
  <label for="color-green">Green</label><br />
  <input type="checkbox" id="color-blue" name="color" value="Blue" checked>
  <label for="color-blue">Blue</label><br />

  <input type="submit" value="Submit">
</form>

Using checked

The checked attribute indicates that the input element is checked, i.e. selected.

Clicking the element will toggle, i.e. check or uncheck, the item.

This attribute only applies to these input types:


Syntax

<input checked>
or
<input checked="checked">

Values

#

Value Description
checked Use 'checked' (without value) or checked='checked'. Both are valid.

More Examples

Two radio <input> elements of which the first one is checked.




<form action="/tutorial/action.html">
  <label>Status</label><br />
  <input type="radio" id="pending" name="status" value="Pending" checked>
  <label for="pending">Pending</label><br />
  <input type="radio" id="closed" name="status" value="Closed">
  <label for="closed">Closed</label><br />

  <input type="submit" value="Submit">
</form>

Browser support

Here is when checked support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides