1

I'm having trouble removing the text that is generated by Chrome autofill with JQuery. Thus far I have been doing this.

$(document).ready(function () {
    $(".link").click(function () {        
        $("#textbox").val("");
        return false;
    });

This removes the text just fine except if it was auto fill text. I would like to be able to remove this text without disabling autocomplete altogether i.e. I don't want to use autocomplete="off."

Right now I'm using JQuery but I'm not opposed to just using plain Javascript instead.

P.S. These text boxes are ASP.NET MVC3 Html.TextBoxFor's. I don't know if that makes a difference.

broguyman
  • 1,386
  • 4
  • 19
  • 36
  • You should post your corresponding ASP.NET MVC3 code. – Justin Helgerson Oct 12 '12 at 17:58
  • 1
    Hey take a look at this: [http://code.google.com/p/chromium/issues/detail?id=46543#c22](http://code.google.com/p/chromium/issues/detail?id=46543#c22) Hope it helps – m1. Oct 12 '12 at 19:22

1 Answers1

1

Perhaps you can use the autocomplete="off" attribute on elements or on the form itself. Related question here Is there a W3C valid way to disable autocomplete in a HTML form?

Community
  • 1
  • 1
dakdad
  • 2,947
  • 2
  • 22
  • 21
  • I don't want to use autocomplete="off" – broguyman Oct 12 '12 at 18:21
  • 1
    Ah, sorry, should have read the question better. I did try to reproduce this but I could remove autofill text with Jquery as well as native JS code `document.forms['form_name']['field_name'].value = '';` just like any other input text – dakdad Oct 12 '12 at 18:39
  • +1 Your comment right here help me figure out what was going on. What was going on would take to long to explain in this venue but basically when you said that you couldn't reproduce the problem I realized what was going on. So thanks for that. – broguyman Oct 12 '12 at 19:32