Created
October 13, 2016 19:24
-
-
Save AllThingsSmitty/452821395961a3800c077130b864fdbd to your computer and use it in GitHub Desktop.
Toggle show/hide password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function togglePassword() { | |
let passwordInput = document.getElementById('txtPassword'); | |
if (passwordInput.type === 'password') { | |
passwordInput.type = 'text'; | |
} else { | |
passwordInput.type = 'password'; | |
} | |
} | |
(function () { | |
let toggle = document.getElementById('btnToggle'); | |
toggle.addEventListener('click', togglePassword, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow, I like this