const inputs = document.querySelectorAll(".input"); function addcl(){ let parent = this.parentNode.parentNode; parent.classList.add("focus"); } function remcl(){ let parent = this.parentNode.parentNode; if(this.value == ""){ parent.classList.remove("focus"); } } inputs.forEach(input => { input.addEventListener("focus", addcl); input.addEventListener("blur", remcl); }); function seePass(){ if(document.getElementById('password').type == "password"){ document.getElementById('password').type = 'text'; document.getElementById('eye').innerHTML = ""; document.getElementById('eye').innerHTML = ''; }else{ document.getElementById('password').type = 'password'; document.getElementById('eye').innerHTML = ""; document.getElementById('eye').innerHTML = ''; } }