okey so I got this, kinda look at it like u have a website were u can redeem points, now when I click redeem I dont want that the number given is lesser than 4 points and that the number given is greater than your balance of points.
Now when I click the button when the input is 2, I will get 2 alerts (alerts are for testing)
But, as soon as I click the button when I put an number lesser than my balance, I also get 2 alerts, saying number = (for example) 7 and balancehidden = 100. So I dont understand why I get those alerts. because its lesser than the balance and greater than 4.
also this is the field the balance get stored when refreshBalance() get called:
 <input type=hidden id="balancehidden" name="balancehide" 
                      value=""/>
Javascript :
<input type="text" id="number"><br>
        <button type="button" class="btn btn-success" id="redeem">Redeem</button>   
     <body onload="refreshBalance()">
            <script type="text/javascript">
            document.getElementById('redeem').onclick = function() {
           if(document.getElementById('number').value < 4 || document.getElementById('number').value > document.getElementById("balancehidden").value)
            {
            alert(document.getElementById("number").value);
            alert(document.getElementById("balancehidden").value);
            }
            }
            </script>
 
     
     
    