views:

359

answers:

3

Is it possible to selectively disable the autofill feature in text fields using code?

I'm developing my custom code in ASP.Net AJAX to search for the suggestion in the database and I would like to prevent the browser suggestions from appearing when the user starts typing in the textbox.

I'm looking for a solution that works in the most modern browsers (IE 7 & 8, Firefox, Safari and Chrome). It's is ok if the workaround is in Javascript.

A: 

Adding an autocomplete=off attribute to the html input element should do that.

Pete Kirkham
+2  A: 

Look at the autocomplete HTML attribute (on form or input tags).

<form [...] autocomplete="off"> [...] </form>

W3C > Autocomplete attribute

Ploufka
+1  A: 

you can put it into your inputs:

<input type="text" name="off" autocomplete="off">

or in jquery

$(":input").attr("autocomplete","off");
Elliott