So im making a form where theres an image on an eye that should show the password when clicked and when clicked again it should hide it. i made that when its clicked it change the src attribute of the img and change the type of input
if(img.src = 'images/eye1.png'){
img.src = 'images/eye2.png';
password.type = 'text'
}
and if the img.src is eye2 so after i click the first time it return back to the original
else if(img.src = 'images/eye2.png') {
img.src = 'images/eye1.png';
password.type = 'password'
}
i tried with else too but it doesnt do anything after the first click and i cant find a solution. help please :(