Trying to code a simple equalizer in JS where user controllers the maxRadius with a slider but i keep getting this error
Uncaught TypeError: Cannot set property 'onchange' of null.
Here is my function:
maxRadius is a global variable declared.
document.querySelector("#slider1").onchange = function(e) {
console.log("value=" + e.target.value);
document.querySelector("#sliderResults").innerHTML = e.target.value;
maxRadius = e.target.value * 500;
};
and here is my html
<div>
<label for="slider1">Circle Size</label>
<input id="slider1" type="range" min="0.1" max="1.0" step="0.1" value="0.5" />
<span style="float:right" id="sliderResults"></span>
</div>