Input Range disabled attribute

Definition and Usage

disabled Attribute to set or return whether the slider control should be disabled.

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed as gray in the browser.

This attribute reflects the HTML disabled attribute.

See also:

HTML Reference Manual:HTML <input> disabled atirin

Example

Example 1

Disable the slider control:

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

Try it yourself

Example 2

Check if the slider control is disabled:

var x = document.getElementById("myRange").disabled;

Try it yourself

Example 3

Disable and enable the slider control:

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

Try it yourself

Syntax

Return disabled attribute:

rangeObject.disabled

Set disabled attribute:

rangeObject.disabled = true|false

attribute value

value description
true|false

Specify whether the slider control should be disabled.

  • true - The slider control is disabled
  • false - Default. The slider control is not disabled

Technical Details

Return value: Boolean value, if the slider control is disabled, it returns true; otherwise return false.

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support