Search code examples
jquerybrowserautocompletebehaviorautosuggest

Preventing the browser's autosuggest when using an autocompleter with jQuery


I'm using a small autocompleter function with jQuery.

That works well.

The problem is that when I'm typing a text in the input, my browser suggests me some of the previous texts I've typed before.

That part covers up the first answer of my autocompleter lookup function...

Here is a snapshot of the problem (the box where "lemp" appears) :

bug_autosuggest.jpg

Is there a way to disable this behaviour ?

I mean "without going in the client-side settings of the browser".

Thanks for your help.


Solution

  • Just set the autocomplete attribute to "off" on your input elements, or on your form element itself.

    <form action="?" method="post" autocomplete = "off">
       ...
    </form>
    

    Source.

    You may want to add it with jQuery.