Input Checkbox indeterminate attribute
Definition and Usage
indeterminate
Whether the attribute has been set or returned, the status of the checkbox has changed.
The checkbox actually has three states: true, false, and indeterminate, indicating that the checkbox is neither 'on' nor 'off'.
The checkbox cannot be set to an indeterminate state through HTML attributes - it must be set through JavaScript.
This state can be used to force the user to select or deselect the checkbox.
Example
Set checkbox to indeterminate state:
document.getElementById("myCheck").indeterminate = true;
Syntax
Return indeterminate attribute:
checkboxObject.indeterminate
Set indeterminate attribute:
checkboxObject.indeterminate = true|false
属性值
值 | 描述 |
---|---|
true|false |
规定复选框的状态。 可能的值:
|
技术细节
返回值: | 布尔值,如果复选框处于不确定状态则返回 true ,否则返回 false 。 |
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |