Skip to content

Instantly share code, notes, and snippets.

@reinink
Created January 26, 2012 15:58
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: ( t h i s ) . a f t e r ( t h i s . o u t e r H T M L ) . r e m o v e ( ) ; w i t h : (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