Skip to content

Instantly share code, notes, and snippets.

@spence
Created April 8, 2014 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spence/10143600 to your computer and use it in GitHub Desktop.
Save spence/10143600 to your computer and use it in GitHub Desktop.
Enable Autocomplete for sites that disable it (bookmarklet)
var forms = document.getElementsByTagName("form");
var inputs = document.getElementsByTagName("input");
var fields = Array.prototype.concat.apply(Array.prototype.slice.call(forms, 0), inputs);
for (var i = 0; i < fields.length; i++) {
fields[i].setAttribute("autocomplete", "on");
fields[i].onpaste = null;
if (window.jQuery) {
window.jQuery(fields[i]).unbind("paste");
}
}
// http://spencercreasey.com/post/36881475809/bookmarklet-enable-autocomplete
// Bookmarklet: javascript:(function()%7B(function(w%2Cd)%7Bfor(var e%3DArray.prototype%2Ct%3De.concat.apply(e.slice.call(d.getElementsByTagName("form")%2C0)%2Cd.getElementsByTagName("input"))%2Cn%3D0%3Bt.length>n%3Bn%2B%2B)%7Bt%5Bn%5D.setAttribute("autocomplete"%2C"on")%3Bt%5Bn%5D.onpaste%3Dnull%3Bif(w.jQuery)%7Bw.jQuery(t%5Bn%5D).unbind("paste")%7D%7D%7D)(window%2Cdocument)%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment