Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLInputElement
  4. checked

HTMLInputElement: checked property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Thechecked property of theHTMLInputElement interface specifies the current checkedness of the element; that is, whether the form control is checked or not.

The booleanchecked property is relevant to theradio (<input type="radio">) andcheckbox (<input type="checkbox">) input types.

The presence of the HTMLchecked attribute indicates the checkbox is checked by default. It does not indicate whether this checkbox is currently checked: if the checkbox's state is changed, this content attribute does not reflect the change; only theHTMLInputElement'schecked IDL property is updated. Thechecked attribute is reflected by thedefaultChecked property.

When a radio inputchecked property istrue, all other radio inputs with the samename arefalse. If any radio button in a same-named group of radio buttons isrequired, as long as one button in the group ischecked, theValidityState object's read-onlyvalueMissing property for each radio button in the group will befalse.

A checkbox's value is only included in the submitted data upon form submission ifchecked is true. The value of theHTMLInputElement.indeterminate property has no effect on a checkbox'schecked value.

Value

A boolean.

Examples

js
const inputElement = document.getElementById("contactMail");console.log(inputElement.checked);inputElement.checked = true;

Specifications

Specification
HTML
# dom-input-checked

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp