Favorites

DOM HTMLInputElement.checked Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
HTMLInputElement.checked
DOM HTMLInputElement PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

The checked property gets or sets whether a checkbox or radio button is ticked.

Description

The checked property reflects the current checked state of a checkbox or radio button. Setting it updates the control immediately, without firing a change event. The checked attribute only sets the initial state. For checkboxes, the separate indeterminate property shows a "mixed" state.

Only one radio button in a group (those sharing a name) can be checked, so checking one with script unchecks the others. To read which radio is selected, use form.elements.groupName.value, or querySelector('input[name=size]:checked').

The defaultChecked property reflects the checked attribute and is what form.reset() returns the control to. The change event fires when the user changes it, but not when you set it from script.

Syntax

input.checked
input.checked = true | false

Value

true if the checkbox or radio button is checked, otherwise false.

Example

<label><input type="checkbox" id="all"> Select all</label><br>
<label><input type="checkbox" class="item"> One</label>
<label><input type="checkbox" class="item"> Two</label>
const all = document.getElementById('all');
const items = document.querySelectorAll('.item');
all.addEventListener('change', () => {
  items.forEach(i => (i.checked = all.checked));
  console.log('Checked items:', [...items].filter(i => i.checked).length);
});
all.click();

Browser Support

The following information will show you the current browser support for the HTMLInputElement.checked property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee