try this
document.querySelector("[type=password]").setAttribute("type","text");
Question
I frequently find myself opening up Web Inspector in Safari when registering on a website and then changing the password field to a text field so I can view the text entered and don't have those black dots that cover up the password.
Opening Web Inspector time and time again is bit of a hassle so I wondered if it wouldn't be possible to use a piece of JS code in my bookmark bar and when I click it, the javascript changes every form input field with type="password"
to type="text"
Tried some things I found on the web, but they didn't really work…
Solution
try this
document.querySelector("[type=password]").setAttribute("type","text");