fitraagungdp

Untitled

Sep 20th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.16 KB | Source Code | 0 0
  1. const container = document.querySelector(".container"),
  2.       pwShowHide = document.querySelectorAll(".hidePW"),
  3.       pwFields = document.querySelectorAll(".password"),
  4.       signUp = document.querySelector(".signup-link"),
  5.       login = document.querySelector(".login-link");
  6.  
  7.     //   js code to show/hide password and change icon
  8.     pwShowHide.forEach(eyeIcon =>{
  9.         eyeIcon.addEventListener("click", ()=>{
  10.             pwFields.forEach(pwField =>{
  11.                 if(pwField.type ==="password"){
  12.                     pwField.type = "text";
  13.  
  14.                     pwShowHide.forEach(icon =>{
  15.                         icon.classList.replace("fa-eye-slash", "fa-eye");
  16.                     })
  17.                 }else{
  18.                     pwField.type = "password";
  19.                     pwShowHide.forEach(icon =>{
  20.                         icon.classList.replace("fa-eye", "fa-eye-slash");
  21.                     })
  22.                 }
  23.             })
  24.         })
  25.     })
  26.  
  27.  
  28.     signUp.addEventListener("click", ()=>{
  29.         container.classList.add("active");
  30.  
  31.     });
  32.     login.addEventListener("click", ()=>{
  33.         container.classList.remove("active");
  34.  
  35.     });
Advertisement
Add Comment
Please, Sign In to add comment