-
Notifications
You must be signed in to change notification settings - Fork 1
/
sign.js
31 lines (28 loc) · 1009 Bytes
/
sign.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const container = document.querySelector(".wrapper");
const pwShowHide = document.querySelectorAll(".showHidePw");
const pwFields = document.querySelectorAll("input[type='password']");
const login = document.querySelector(".login-link");
pwShowHide.forEach(eyeIcon => {
eyeIcon.addEventListener("click", () => {
pwFields.forEach(pwField => {
if (pwField.type === "password") {
pwField.type = "text";
} else {
pwField.type = "password";
}
});
// Toggle eye icon classes
pwShowHide.forEach(icon => {
if (icon.classList.contains("uil-eye")) {
icon.classList.remove("uil-eye");
icon.classList.add("uil-eye-slash");
} else {
icon.classList.remove("uil-eye-slash");
icon.classList.add("uil-eye");
}
});
});
});
login.addEventListener("click", () => {
container.classList.remove("active");
});