Is it possible to resolve this issue? I keep getting a result of less than 18 when trying numbers 1-100, even though the output should be for values under 18.
In my HTML code, there is a <p> element with id="result", an input with id="age", and a button with id="btn".
JavaScript:
let result = document.getElementById("result");
let button = document.getElementById("btn");
let age = document.getElementById("age");
function checkAge() {
if (age >= 18){
document.getElementById("result").innerHTML = "You have successfully signed up.";
}
if (age <= 65){
document.getElementById("result").innerHTML = "You have successfully signed up.";
}
if (age < 18){
document.getElementById("result").innerHTML = "You are too young to sign up.";
}
if (age > 65){
document.getElementById("result").innerHTML = "You are too old to sign up.";
}
}