I am making a website where I want to use range slider(I know it only supports webkit browsers).
I have integrated it fully and works fine. But I would like to use a textbox
to show the current slide value.
I mean if initially the slider is at value 5, so in text box it should show as 5, when I slide the value in text box should change.
Can I do this using only CSS
or html
. I want to avoid JQuery
. Is it possible?
For those who are still searching for a solution without a separate javascript code. There is little easy solution without writing a javascript or jquery function:
<input type="range" value="24" min="1" max="100" oninput="this.nextElementSibling.value = this.value">
<output>24</output>
If you want to show the value in text box, simply change output to input.
Update:
It is still Javascript written within your html, you can replace the bindings with below JS code:
document.registrationForm.ageInputId.oninput = function(){
document.registrationForm.ageOutputId.value = document.registrationForm.ageInputId.value;
}
Either use element's Id or name, both are supported in morden browsers.