Search code examples
htmlcssrange

HTML5 input type range show range value


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?


Solution

  • This uses javascript, not jquery directly. It might help get you started.

    function updateTextInput(val) {
              document.getElementById('textInput').value=val; 
            }
    <input type="range" name="rangeInput" min="0" max="100" onchange="updateTextInput(this.value);">
    <input type="text" id="textInput" value="">