Input Range value Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range


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>
Points: <input type="range" id="myRange" value="20">

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

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

function myFunction() {/*  ww w. j  a va 2  s  . c o m*/
    document.getElementById("myRange").value = 10;


Related Tutorials