Html range slider - oninput not working in IE 11

I implemented a range slider that uses a value to get an element from an array and displays it instead of displaying a range value. It works in Chrome and Firefox, but not in IE 11 - the value does not receive the updated item when moving the slider.

HTML:

<div id="yearSlider" style="z-index:2";>    
<form>
<div align="center">
<input type="range" min=1 max=10 value=0 id="fader" step=1 oninput="outputUpdate(years[value])">

<output for=fader id=volume>1908</output> 
</div>
</form>

JavaScript:

var years = [0,1908, 1910, 1912, 1915, 1920, 1935, 1949, 1982, 2005, 2015];

function outputUpdate(vol) {
document.querySelector('#volume').value = vol;
}

As a result of the search, I see that this has something to do with how "oninput" works (or not) in IE.

I tried to enable the solution from here

<input type="range" min="5" max="10" step="1" 
oninput="showVal(this.value)" onchange="showVal(this.value)">

but it is still not updating.

My jsfiddle

+4
source share

Source: https://habr.com/ru/post/1619665/


All Articles