Javascript and class class = input-range do not work, i.e.

I have a problem with some simple javascript that doesn't work in ie. My code is here:

<script>
function test(){
var myDivElem = document.getElementById("mydiv");
var sizerange= document.getElementById("sizeID");
myDivElem.innerHTML = sizerange.value;
}
</script>

<div>
<p>

<form action="url-link-here" method="post">

<span id="mydiv">100</span>

<input class="input-range" id="sizeID" oninput="test()" type="range" name="size" value="100" min="5" max="250" step ="5">

It works great in all other browsers.      

  
+1
source share
1 answer

Use onchange instead of oninput . Worked in IE11

function test() {
    var myDivElem = document.getElementById("mydiv");
    var sizerange = document.getElementById("sizeID");
    myDivElem.innerHTML = sizerange.value;
  }
<form action="url-link-here" method="post">

  <span id="mydiv">100</span>

  <input class="input-range" id="sizeID" oninput="test()" onchange="test()" type="range" name="size" value="100" min="5" max="250" step="5">
</form>
Run codeHide result
+2
source

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


All Articles