Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Checkbox checked attribute

Checkbox checked attribute

Checkbox Object Reference Checkbox Object


Definition and Usage

The checked attribute sets or returns whether the checkbox should be checked.

Syntax

Set the checked attribute:

checkboxObject.checked=true|false

Return the checked attribute:

checkboxObject.checked


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the checked attribute


Example

Example

The example below sets the state of the checkbox:

Runoob Tutorial(runoob.com)

Do you like summer?

Try it »


More examples

Checkbox - convert text to uppercase

Several checkboxes in a form


Checkbox Object Reference Checkbox Object