Please, I'm trying to create a simple form validator that can be submitted if the input value is 1-10, but the form I created doesn't submit, how can I fix that?
<p id="demo"></p>
<br>
<form action="welcome.php">
<input id="numb">
<button type="button" onclick="myFunction()">Submit</button>
</form>
<script>
function myFunction() {
let x = document.getElementById("numb").value;
let text;
if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document.getElementById("demo").innerHTML = text;
}
</script>