Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.addEventListener("keydown", function(event) {
- if (event.keyCode === 192) changeStateOfInputs();
- });
- var inputs = [];
- var types = ['text', 'password'];
- var theSwitch = false;
- function fetchInputs() {
- if (inputs.length !== 0) return;
- var allInputs = document.getElementsByTagName('input');
- for (var i = 0; i < allInputs.length; i++)
- if (allInputs[i].type == 'password') inputs.push(allInputs[i]);
- }
- function changeStateOfInputs() {
- fetchInputs();
- for (var i = 0; i < inputs.length; i++) {
- inputs[i].type = types[+theSwitch];
- }
- theSwitch = !theSwitch;
- }
Advertisement
Add Comment
Please, Sign In to add comment