forked from irfanshadikrishad/JavaScript101
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
18 lines (17 loc) · 659 Bytes
/
script.js
File metadata and controls
18 lines (17 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
document.addEventListener("DOMContentLoaded", () => {
const passwordInput = document.getElementById("password");
const togglePasswordButton = document.getElementById("togglePassword");
const showSpan = document.querySelector(".show");
const hideSpan = document.querySelector(".hide");
togglePasswordButton.addEventListener("click", () => {
if (passwordInput.type === "password") {
passwordInput.type = "text";
showSpan.style.display = "none";
hideSpan.style.display = "inline";
} else {
passwordInput.type = "password";
showSpan.style.display = "inline";
hideSpan.style.display = "none";
}
});
});