Input Range max Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range


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

Set the max property with the following Values

Value Description
number Sets the maximum value allowed for the slider control

Return Value

A String, representing the maximum value allowed

The following code shows how to get the maximum value allowed for a slider control:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
Points: <input type="range" id="myRange" min="25" max="75">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {//  www  .  ja va2  s  .  com
    var x = document.getElementById("myRange").max;
    document.getElementById("demo").innerHTML = x;


Related Tutorials