Struggling to get this code to work on my website, and it's starting to drive me crazy. I followed the instructions from BenjaminMiles' website, but something just isn't clicking.
The jquery code snippet I'm using is:
<script>
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
$(window).load(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);
});
});
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="text" name="text" />
Despite trying everything, nothing seems to be working for me. The box-shadow trick didn't help either, especially since I have a background image set for my input field.
I've made sure to place the code within the body tag, so where could I possibly be going wrong?