Skip to content

Instantly share code, notes, and snippets.

Last active Aug 16, 2017
What would you like to do?
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