var user = window.prompt("Welcome to the Vacation Planner. Please enter yourname");
document.getElementById("greeting").innerHTML += ", " + user;
var enterDays = document.getElementById("enterDays");
/*
function.calculateDays(){
var dayMessage = document.getElementById("dayMessage");
if(enterDays <4){
dayMessage.innerHTML = "Short trips are always worth it!";
}
else if(enterDays<7){
dayMessage.innerHTML = "Cool, you'll be there for a week"
}
else{
dayMessage.innerHTML = "You'll have plenty of time to relax and have fun!"
}
}*/
enterDays.onclick = calculateDays;
When I enter this code, the window.prompt work correctly. But when I uncomment the function.calculateDays, the window.prompt stop working. Can anybody explain why is it happening and how to solve it? Thanks a lot!!!
function.calculateDays
is not valid syntax and will throw a syntax error that will prevent future code from calling, to fix it replace it with function calculateDays
.