checked
checked
This page has been flagged with the following issues:
High-level issues:
Summary
Sets or retrieves the state of the check box or radio button.
| Applies to | ? |
|---|
Examples
View live exampleThis example retrieves the checked property to fire an event.
<head>
<script>
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>
Notes
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. Windows Internet Explorer 8 and later. In IE8 Standards mode, parsing operations on the checked content attribute always affect both the checked content attribute and defaultChecked Document Object Model (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) For more information on IE8 mode, see Defining Document Compatibility. Internet Explorer 8 and later. In IE8 mode, the defaultChecked DOM attribute reflects the value of the checked content attribute.
Syntax
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
- HTML 4.01 Specification, Section 17.4
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? | ? | ? | ? |
See also
Related pages (MSDN)
input type=checkboxinput type=radioinputReferencedefaultCheckedConceptualIntroduction to FormsForm controls part 1Form controls part 2: validation
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here