Get the maximum value allowed for a slider control:
var x = document.getElementById("myRange").max;
Click the button to display the value of the max attribute of the slider control.
<!DOCTYPE html> <html> <body> Points: <input type="range" id="myRange" min="25" max="75"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . j a va 2 s. co m*/ var x = document.getElementById("myRange").max; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The max property sets or gets the value of the max attribute of a slider control.
The max attribute sets the maximum value for a slider control.
The max property accepts and returns a number type value.