Skip to content

Instantly share code, notes, and snippets.

@sh78
Last active April 18, 2018 02:28
Show Gist options
  • Save sh78/9ece79951ec253555b57 to your computer and use it in GitHub Desktop.
Save sh78/9ece79951ec253555b57 to your computer and use it in GitHub Desktop.
/* use a CSS selector to change the value of multiple text inputs on a page with the browser console */
// Enter a css selector to operate on
var theSelectorIsHere = 'TYPE_HERE';
// Enter desired value
var whatItShouldBe = 'TYPE_HERE';
// Don't worry about this part, paste in the the browser console
var whereItShouldBe = document.querySelectorAll(theSelectorIsHere);
function superDuperValChanger (targets, input) {
for (var i = targets.length - 1; i >= 0; i--) {
targets[i].value = input;
};
}
superDuperValChanger(whereItShouldBe, whatItShouldBe);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment