Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Range disabled Property

Input Range disabled Property

Input Range Object Reference Input Range Object

Example

Disable the slider control:

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

Output result:

Try it »


Definition and Usage

The disabled property sets or returns whether the slider control is disabled.

Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray in the browser.

This attribute reflects the HTML disabled attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.

Note: Internet Explorer 9 and earlier versions do not support the HTML using the type="range" attribute .


Syntax

Return the disabled attribute:

rangeObject

.disabled

Set the disabled attribute:

rangeObject

.disabled=true|false

Attribute values

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

    Technical Details

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

    More examples

    Example

    Check whether the slider control is available:

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

    x

    The output is:

    true

    Try it »

    Example

    Disable or enable the slider control:

    function disableBtn() {

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

    }

    function undisableBtn() {

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

    }

    Try it »


    Related pages

    HTML Reference Manual: HTML disabled attribute


    Input Range Object Reference Input Range Object