Skip to content

Instantly share code, notes, and snippets.

@glideranderson
Created September 19, 2012 17:53
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 glideranderson/3751098 to your computer and use it in GitHub Desktop.
Save glideranderson/3751098 to your computer and use it in GitHub Desktop.
Chrome hack to remove yellow autofill fields, but retain value
# hack to not show Chrome's yellow background on autofill form fields
if navigator.userAgent.toLowerCase().indexOf("chrome") >= 0
$(window).load ->
$('input:-webkit-autofill').each ->
$field = $(@)
parent = $field.closest '.control-group'
text = $field.val()
name = $field.attr 'name'
$field.after(this.outerHTML).remove()
parent.find("input[name='#{name}']").val(text);
@kurtextrem
Copy link

So you could pratically log every autofill value? Not sure if good...

@glideranderson
Copy link
Author

no this is not really a good idea. But it's been I think 3 or 4 yrs (at least 2 yrs) of chrome sitting on this bug of the designer not having the ability to change the style of an autofill field. Thus a hack is born.

This is where this hack (and code) originated from: http://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20OS%20Area%20Feature%20Status%20Owner%20Summary&groupby=&sort=&id=46543

@minanagehsalalma
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment