I want to create password toggle function when clicked on the eye icon using Javascript only. I have written code for it but it works only to show the password text and not
function action() { var my_pass = document.getElementById("pass"); if (my_pass.type === "password") { my_pass.type = "text"; } else { my_pass.type = "password"; } }
Show