Input Range step Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range


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

Set the step property with the following Values

Value Description
number Sets the size of each movement. Default is "1"

Return Value

A Number, representing the increment between values

The following code shows how to change the value of the step attribute:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
Points: <input type="range" id="myRange" step="5">

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

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

function myFunction() {//from  w w  w. j ava  2s. c om
    var x = document.getElementById("myRange").step = "25";
    document.getElementById("demo").innerHTML = "The value of the step attribute was changed from '5' to '25'.";


Related Tutorials