Skip to content

Instantly share code, notes, and snippets.

@hozefaj
Last active August 16, 2017 17:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hozefaj/b9df41c6d2ea57357dbd9c5641aa784f to your computer and use it in GitHub Desktop.
Save hozefaj/b9df41c6d2ea57357dbd9c5641aa784f to your computer and use it in GitHub Desktop.
JS code to show passwords field values when filling forms
// change passwords fields into text on a web page
const nodeList = document.getElementsByTagName("input");
[...nodeList].forEach(node => {
if(node.getAttribute("type") === "password"){
node.setAttribute('type', 'text');
}
});
// wrap code within github to multiple lines
// this helps to prevent horizontal scroll
[...document.querySelectorAll('code')].map(code => code.setAttribute('style', 'white-space: pre-wrap'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment