Sets or retrieves the state of the check box or radio button.
![]() |
Syntax
| HTML | <element checked="p" ... > |
|---|---|
| JavaScript | |
Property values
Type: Boolean
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
- HTML 4.01 Specification, Section 17.4
Remarks
Check boxes that are not selected do not return their values when the form is submitted.
A user can select a radio button only if the button has a name. To clear a selected radio button, a user must select another button in the set.
Examples
This example retrieves the checked property to fire an event.
<head>
<script type="text/javascript">
function checkthis()
{
if (oCheckbox.checked == true)
{
window.open("http://www.microsoft.com");
}
}
</script>
</head>
<body>
<p>Check here if you wish to go to Microsoft:
<input id="oCheckbox" type="checkbox" onclick="checkthis()"></p>
</body>
See also
- input type=checkbox
- input type=radio
- input
- Reference
- defaultChecked
- Conceptual
- Introduction to Forms
- Form controls part 1
- Form controls part 2: validation
Build date: 11/28/2012
