0

function auth() {
  x = document.getElementById("user").value;
  y = document.getElementById("pass").value;

  if (x == "admin" && y == "12345") {
    alert("You have successfuly log in")
    window.location.href = "index.html";
  } else {
    alert("Invalid login credentials. Please try again.");
  }
}
<form id="login" class="input-group">
  <input type="text" id="user" class="input-field" placeholder="Username" required>
  <input type="password" id="pass" class="input-field" placeholder="Password" required>
  <input type="checkbox" class="checkbox"><span>Remember Password</span>
  <button type="submit" class="submit-btn" onclick="auth()">Log in</button>
</form>

when i enter the static user and pass it does continue to alert("You have successfuly log in") but it does not continue to window.location.href = "index.html";. they are on the same folder help me please im a newbie in this

Aᴍɪʀ
  • 7,623
  • 3
  • 38
  • 52

0 Answers0