Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Toggle show/hide password
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
You can’t perform that action at this time.