Input Range max Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range

Description

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>
<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   ww w . ja  v a  2s  . c  o m
    var x = document.getElementById("myRange").max;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials