I need help with this simple issue. Whenever I activate the code below, I always get the result from else, no matter my input. I want to check if the day is between 1 and 30 inclusive, and if it is activate whatever is inside the if function. If it's not between 1 and 30, I want to run the else function and display the error message.
var day;
function changePage(){
if(day < 30 && day > 1){
day = document.getElementById("inputBox").value;
console.log(day);
window.location.href = "day-" + day + ".html";}
else{
alert("Invalid entry, must be between 1 and 30");}}
dayvalue?day === undefinedso it's not between 1 and 30.