-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
27 lines (24 loc) · 791 Bytes
/
main.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
const forms = document.querySelector(".forms"),
pwShowHide = document.querySelectorAll(".eye-icon"),
links = document.querySelectorAll(".link");
pwShowHide.forEach((eyeIcon) => {
eyeIcon.addEventListener("click", () => {
let pwFields =
eyeIcon.parentElement.parentElement.querySelectorAll(".password");
pwFields.forEach((password) => {
if (password.type === "password") {
password.type = "text";
eyeIcon.classList.replace("bx-hide", "bx-show");
return;
}
password.type = "password";
eyeIcon.classList.replace("bx-show", "bx-hide");
});
});
});
links.forEach((link) => {
link.addEventListener("click", (e) => {
e.preventDefault(); //preventing form submit
forms.classList.toggle("show-signup");
});
});