<!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<title></title>
<body>
<h2>JavaScript Can Validate Input</h2>
<p>Please input a number between 1 and 10:</p>
<input Id="numb">
<button type="button" onClick="HI()">Submit</button>
<p Id="demo"></p>
<script language="javaScript">
function HI() {
<p>checking</p>
var x,text;
x = document.getElementbyId("numb").value;
if (isNaN(x) || x < 1 || x > 10){
text = "Input invalid";
} else {
text="Okay";
}
document.getElementById("demo").innerHTML=text;
}
</script>
</body>
</html>
I can’t see your code. Please add your code, using the </>
button to add the ```
characters around your code.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
@ArielLeslie What challenge is this for? Just so I can see what we can do to help this member
It doesn’t look like a freeCodeCamp challenge I recognize. I just fixed the formatting. I don’t know what @Qaisrani is trying to do or what they need help with.
This is exactly why I was asking because I did not recognize any challenge having stuff like this.