Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const container = document.querySelector(".container"),
- pwShowHide = document.querySelectorAll(".hidePW"),
- pwFields = document.querySelectorAll(".password"),
- signUp = document.querySelector(".signup-link"),
- login = document.querySelector(".login-link");
- // js code to show/hide password and change icon
- pwShowHide.forEach(eyeIcon =>{
- eyeIcon.addEventListener("click", ()=>{
- pwFields.forEach(pwField =>{
- if(pwField.type ==="password"){
- pwField.type = "text";
- pwShowHide.forEach(icon =>{
- icon.classList.replace("fa-eye-slash", "fa-eye");
- })
- }else{
- pwField.type = "password";
- pwShowHide.forEach(icon =>{
- icon.classList.replace("fa-eye", "fa-eye-slash");
- })
- }
- })
- })
- })
- signUp.addEventListener("click", ()=>{
- container.classList.add("active");
- });
- login.addEventListener("click", ()=>{
- container.classList.remove("active");
- });
Advertisement
Add Comment
Please, Sign In to add comment