Javascript Reference - HTML DOM Input Range min Property








The min property sets or gets the min attribute of a slider control.

The min attribute specifies the minimum value for a slider control.

Browser Support

min Yes 10 Yes Yes Yes

Syntax

Return the min property.

var v = rangeObject.min 

Set the min property.

rangeObject.min=number




Property Values

Value Description
number Set the minimum value allowed for the slider control

Return Value

A String type value representing the minimum value allowed.

Example

The following code shows how to change the minimum value.


<!DOCTYPE html>
<html>
<body>
<!-- w w  w.j a  v a 2s.c  om-->
Points: <input type="range" id="myRange" min="25" max="75">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
    var x = document.getElementById("myRange").min = "50";
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to get the minimum value allowed for a slider control.


<!DOCTYPE html>
<html>
<body>
Points: <input type="range" id="myRange" min="25" max="75">
<button onclick="myFunction()">test</button>
<!--from   w w  w.j  av  a2  s .  c  o  m-->
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myRange").min;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: