Home > Software design >  window.location.href not redirecting to another page
window.location.href not redirecting to another page

Time:08-29

window.location.href not redirecting to another page

document.getElementById("login-submit").addEventListener("click", function () {
//get user email
const emailField = document.getElementById("user-email");
const userEmail = emailField.value;

//get user password
const passwordField = document.getElementById("user-password");
const userPass = passwordField.value;

if (userEmail == "[email protected]" && userPass == "123") {
    window.location.href = "./bank.html";
    console.log("clicked");
}

});

CodePudding user response:

Remove dot from window.location.href = "./bank.html";

Like this window.location.href = "/bank.html";

CodePudding user response:

Just filename is enough.. no need ./filename

window.location.href = "bank.html";
  • Related