Input Range value Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range

Description

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

Set the value property with the following Values

Value Description
number Sets the value of the slider control.

Return Value

A String, representing a number that represents the value of the slider control

The following code shows how to change the value of a slider control:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Points: <input type="range" id="myRange" value="20">

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

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

<script>
function myFunction() {/*from ww  w .j av  a2 s.c om*/
    document.getElementById("myRange").value = 10;
}
</script>

</body>
</html>

Related Tutorials