I have an input range slider on my page that displays several values. I want to change CSS values of the elements on the same page when the value changes. I am well aware of the onChange function but I was wondering if there was a way to run the function changeAtt when it reaches a specific value, e.g. 2.
HTML:
<div id="change"></div>
<input class="slider "type="range" min="0" max="3" value="0" step="1" onchange="showValue(this.value)" />
<span id="range">0</span>
CSS:
#change {
color:black;
}
JS:
function showValue(newValue) {
document.getElementById("range").innerHTML=newValue;
}
function changeAtt() {
document.getElementById("change").style.color = "white";
}