Javascript DOM HTML Input Range disabled Property set

Introduction

Disable a slider control:

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

Click the button to disable the slider control.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="range" id="myRange">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {//w  w w.  j  a v  a2s .c  om
  document.getElementById("myRange").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a slider control should be disabled.

This property mirrors the HTML disabled attribute.

The disabled property accepts and returns a boolean type value.

Value Description
true The slider control is disabled
false Default. The slider control is not disabled

The disabled property returns true if the slider control is disabled, otherwise it returns false.




PreviousNext

Related