Input Range disabledProperty

Input Range 对象参考手册Input Range Object

Example

Disable the slider control:

document.getElementById("myRange").disabled = true;

Output:


Try it Yourself »

Definition and Usage

The disabled property is used to set or return whether the slider control is disabled.

Elements with the disabled attribute are unusable and unclickable. Disabled elements are usually displayed in gray in the browser.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.

Note:Internet Explorer 9 and earlier IE versions do not support HTML <input> elements with the type="range" attribute.


Syntax

Return the disabled property:

rangeObject.disabled

Set the disabled property:

rangeObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the slider control is enabled.
  • true - The slider control is disabled
  • false - Default. The slider control is enabled

Technical Details

Return Value: A Boolean value, returns true if the slider control is disabled, otherwise returns false


More Examples

Example

Check whether the slider control is enabled:

var x = document.getElementById("myRange").disabled;
xThe output is:
true

Try it Yourself »

Example

Disable or enable the slider control:

function disableBtn() {
    document.getElementById("myRange").disabled = true;
}
function undisableBtn() {
    document.getElementById("myRange").disabled = false;
}

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> disabled attribute


Input Range 对象参考手册Input Range Object Other Extensions