Skip to content

Instantly share code, notes, and snippets.

@reinink
Created January 26, 2012 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reinink/1683466 to your computer and use it in GitHub Desktop.
Save reinink/1683466 to your computer and use it in GitHub Desktop.
Remove yellow background caused by Google Chrome autocomplete
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0)
{
$(window).load(function()
{
setTimeout(function()
{
$('input:-webkit-autofill').each(function()
{
var text = $(this).val();
var name = $(this).attr('name');
$(this).after(this.outerHTML).remove();
$('input[name=' + name + ']').val(text);
});
}, 50);
});
}
@sabival89
Copy link

@reinink Nice script. Got it working but replaced: $(this).after(this.outerHTML).remove(); with: $(this).after(this.outerHTML).before().addClass('remove');

Works perfectly. Thanks bro!

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