mercredi 30 octobre 2019

i have a range slider in which i want to control the value change. if slider value is greater than 0.. say good day

<div class="container"><div id="number">0</div>
        <input type="range" min="0" max="10" value="0" id="slider"></div>
<script>
        var slider=document.
            getElementById("slider");
        var number=document.
            getElementById("number");
        slider.oninput=function(){
            number.innerHTML=slider.
                value;}
</script>
<p id="demo">good evening</p>

for some reason its not working when i have number or slider or slider.value in the if statement.

<script>

    if (number> '0' ){document.getElementById("demo").innerHTML = "Good day!";}
    </script>

Aucun commentaire:

Enregistrer un commentaire