How can I change the background color of the body when the value of an input range changes?
Below is the HTML code:
<div class="range">
<input type="range" min="1" max="100" value="0" class="slider" id="myRange">
</div>
And here is the corresponding Javascript code:
let slider = document.getElementById("myRange");
slider.onchange = () => {
document.body.style.background = `linear-gradient(90deg, #2b2e43 0%,#2b2e43 50%,#ffffff 50.1%,#ffffff 100%);`
}