When working with a slider, I am trying to detect when the user changes the value of the slider in order to display it. I have been following the tutorial at https://www.w3schools.com/howto/howto_js_rangeslider.asp.
However, this code is not compatible with TypeScript. Currently, I am using the following code:
var slider = (<HTMLInputElement>document.getElementById("myRange")).value;
var output = document.getElementById("demo");
output.innerHTML = slider
In an attempt to capture the event, I tried:
const onChange = output.innerHTML = slider;
But the value is not changing. Do you know how to use the event oninput
in TypeScript?