defaultChecked property
Sets or retrieves the state of the check box or radio button.
Syntax
| JavaScript | |
|---|
Property values
Type: Boolean
-
Default. Check box or radio button is selected by default.
-
Check box or radio button is not selected by default.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
Remarks
The property can be changed programmatically, but doing so has no effect on the appearance of the check box or radio button or on how forms are submitted.
Windows Internet Explorer 8 and later. In IE8 Standards mode, the defaultChecked Document Object Model (DOM) attribute reflects the value of the checked content attribute. For more information, see Attribute Differences in Internet Explorer 8.
Internet Explorer 8 and later. In IE8 mode, parsing operations on the checked content attribute always affect both the checked content attribute and defaultChecked DOM attribute. For example, removeAttribute('checked') sets both checked and defaultChecked to false. Similarly, setAttribute('checked', 'checked') sets both DOM attributes to true (as if the element was being re-parsed).
See also