click to return false, click again to return true javascript
I have one (if) and one (else if) and (else) I want something like this: when the user clicked on the button for the first time the (else if) statement will be executed and when the user clicked on the button for the second time the (else if) not to be executed This is my code <!DOCTYPE html> <html> <body> <p>Please input a number between 1 and 10:</p> <input id="numb"> <button type="button" onclick="myFunction()">Submit</button> <p id="demo"></p> <script> function myFunction() { var x, text; x = document.getElementById("numb").value; if (isNaN(x) || x > 10) { text = "Input not valid"; } else if (x < -1) { text = "X is less than 0" } else { text = "Input OK"; } document.getElementById("demo").innerHTML = text; } </script> </body> </html> I hope you guys understood what I want to do, and what's my goal