Created
December 9, 2019 12:26
-
-
Save Ze1598/150f06a0ce8c9e3f8dcfdf9212b3598b to your computer and use it in GitHub Desktop.
Login page - JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const loginForm = document.getElementById("login-form"); | |
const loginButton = document.getElementById("login-form-submit"); | |
const loginErrorMsg = document.getElementById("login-error-msg"); | |
loginButton.addEventListener("click", (e) => { | |
e.preventDefault(); | |
const username = loginForm.username.value; | |
const password = loginForm.password.value; | |
if (username === "user" && password === "web_dev") { | |
alert("You have successfully logged in."); | |
location.reload(); | |
} else { | |
loginErrorMsg.style.opacity = 1; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment