Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Last active June 18, 2020 16:32
Show Gist options
  • Save iamandrewluca/19c7af78d28e0f92963130a71800c129 to your computer and use it in GitHub Desktop.
Save iamandrewluca/19c7af78d28e0f92963130a71800c129 to your computer and use it in GitHub Desktop.
Toggle password inputs to text back and forth #bookmarklet
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
const passwordInputs = document.querySelectorAll('[type="password"], [data-password-bookmark-toggled]');
Array.from(passwordInputs).forEach(e => {
if (e.getAttribute('data-password-bookmark-toggled')) {
e.removeAttribute('data-password-bookmark-toggled');
e.setAttribute('type', 'password');
} else {
e.setAttribute('data-password-bookmark-toggled', true);
e.setAttribute('type', 'text');
}
})
})())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment