0
How I can get the number of an input type=range slider?
How I can get the number of an input type=range slider with javascript? Thanks for you help :D
5 ответов
+ 1
Hi Henry Steinhauer,
The number on a range slider is assigned through the "value" attribute, so you can fetch that like you would any other attribute:
getAttribute("value")
I hope this helps! :)
+ 1
Expanded example:
<input type="range" id="myRange" value="90">
<br>
<button onclick="myFunction()">Grab slider value</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myRange").getAttribute("value");
document.getElementById("demo").innerHTML = x;
}
</script>
+ 1
thanks for your answers and help.
I have resolve the problem :D
+ 1
Anytime! 👍