Just trying to get a very simple js login to validate a static username/password however cant seem to get it to work. Any help would be appreciated.
var checkLoginPass = function () {
var login = document.getElementById("login").value;
var pass = document.getElementById("password").value;
if (login === "user123" && pass === "password1234") {
window.location("http://www.google.com");
}
else {
//do something else;
}
};
<input type="text" id="login" required>
<input type="text" id="password" required>
<input type="button" id="goButton" onclick="checkLoginPass()" value="Log In"/>
See Question&Answers more detail:os