Javascript examples for DOM HTML Element:Input Range
The disabled property sets or gets whether a slider control should be disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a slider control should be disabled |
A Boolean, returns true if the slider control is disabled, otherwise it returns false
The following code shows how to disable a slider control:
<!DOCTYPE html> <html> <body> <input type="range" id="myRange"><br><br> <button onclick="disableBtn()">Disable Slider Control</button> <button onclick="enableBtn()">Enable Slider Control</button> <script> function disableBtn() {//from ww w . j a v a 2 s . com document.getElementById("myRange").disabled = true; } function enableBtn() { document.getElementById("myRange").disabled = false; } </script> </body> </html>