The max
property sets or gets the max attribute of a slider control.
The max
attribute specifies the maximum value for a slider control.
max |
Yes | 10.0 | Yes | Yes | Yes |
Return the max property.
var v = rangeObject.max
Set the max property.
rangeObject.max=number
Value | Description |
---|---|
number | Set the maximum value allowed for the slider control |
A String type value representing the maximum value allowed.
The following code shows how to change the maximum value.
<!DOCTYPE html>
<html>
<body>
Points: <input type="range" id="myRange" min="25" max="75">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w w w . j a v a 2 s . c o m-->
var x = document.getElementById("myRange").max = "90";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the maximum value allowed for a slider control.
<!DOCTYPE html>
<html>
<body>
<!-- w w w . jav a2 s .c o m-->
Points: <input type="range" id="myRange" min="25" max="75">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myRange").max;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: