Skip to main content

Function: isElementChecked()

isElementChecked(element): boolean

Defined in: packages/core/src/utils/elementStateUtil.ts:35

Whether the element is checked, via the native checked property of an <input type="checkbox">/<input type="radio">, or aria-checked="true" on an element whose explicit role is a checkable one.

aria-checked="mixed" and a native indeterminate control both report false: this contract is two-state, and "partially checked" is not "checked". An element that cannot be checked at all reports false rather than throwing, so the read stays total in both engines.

Parameters​

element​

Element

The element whose checked state is being decided. It must be the control itself; a <label> pointing at one is not retargeted.

Returns​

boolean