samedi 3 avril 2021

if statements arent working and i dont know why

here is the current version im using for a page

input = toString(document.getElementById("pass").value);

function check() {
  if (input == "test") {
    location.replace("https://google.com");
    console.log("correct");
  }
  else {
    document.getElementById("pass").value = "";
    alert("Incorrect Password");
    console.log("incorrect");
  }
}

i tried it without the toString() function and it still doesnt work.

also here is the html linked to it:

<div class="main">
       <input class="password" id="pass" type="text" placeholder="Enter Your Class">
       <button class="password" onclick="check()">Join</button>
</div>

Aucun commentaire:

Enregistrer un commentaire