Skip to content

Instantly share code, notes, and snippets.

@genecyber
Created July 24, 2014 14:36
Show Gist options
  • Save genecyber/a3f90f2f8891ac794fff to your computer and use it in GitHub Desktop.
Save genecyber/a3f90f2f8891ac794fff to your computer and use it in GitHub Desktop.
Bookmarklet to easily add n characters to every input field on a page
javascript: (function() {
var count = prompt("Enter the number of random characters to add to found inputs.", "1000000");
jscript = document.createElement("script");
jscript.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js";
jscript.onload = jscript.onreadystatechange = function() {};
document.body.appendChild(jscript);
$.noConflict();
jQuery.noConflict();
jQuery.each(jQuery("input"), function() {
var name = this.attributes;
if (name.getNamedItem("type").value != "hidden" && name.getNamedItem("type").value != "submit" && name.getNamedItem("type").value != "checkbox" && name.getNamedItem("type").value != "file") {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < count; i++) text += possible.charAt(Math.floor(Math.random() * possible.length));
jQuery(this).val(text);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment