Latest web development tutorials

HTML DOM Checkbox checked property

Checkbox Object Reference Checkbox objects

Definition and Usage

checked property sets or returns whether a checkbox should be checked.

grammar

Setting checked properties:

checkboxObject.checked=true|false

Returns checked attributes:

checkboxObject.checked


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support checked property


Examples

Examples

The following examples set the status of the checkbox:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function check () {
document.getElementById ( "check1"). checked = true
}
function uncheck () {
document.getElementById ( "check1"). checked = false
}
</ Script>
</ Head>
<Body>

<Form>
<Input type = "checkbox" id = "check1"> do you like summer?
</ Form>
<Button onclick = "check ()"> to confirm the selection box </ button>
<Button onclick = "uncheck ()"> does not confirm the selection box </ button>

</ Body>
</ Html>

try it"


Examples s

More examples

Checkbox - the text is converted to uppercase

A form of several checkbox


Checkbox Object Reference Checkbox objects