Get Input Range Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Range

Introduction

The Input Range object represents an HTML <input> element with type="range".

You can access an <input> element with type="range" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="range" id="myRange" value="90">

<button onclick="myFunction()">get the value of the slider control</button>

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

<script>
function myFunction() {/*  w  ww  .j av  a  2 s . c  om*/
    var x = document.getElementById("myRange").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials