Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- document.querySelector("#show").addEventListener("click", (e) => {
- let target = e.target;
- let password = document.querySelector("#password");
- let type = password.getAttribute("type");
- if(type == "text"){
- password.setAttribute("type", "password");
- target.textContent = "show password";
- }else if(type == "password"){
- password.setAttribute("type", "text");
- target.textContent = "hide password";
- }
- })
- </script>
Add Comment
Please, Sign In to add comment