Turn on/off Autocomplete for Input

By | December 20, 2013

It just a input attributes. Use autocomplete=”off” attributes in input.

<input name=”name” type=”text” autocomplete=”off” />

It useful when unique text input. Such as captch text, auto-suggest or autocomplete feature, credit card information or where you need one time user input.

Using jQuery.

jQuery(‘input’).attr(‘autocomplete’,’off’);

or

jQuery(‘input’).prop(‘autocomplete’,’off’);
// prop is replaced attr method in current jquery version. I think in 1.4 version of jQuery not sure.

Why it required?

In current era browser cached more and more user input to give better and quick performance. In case you do not want to auto complete fill up in input element so you can off it using autocomplete attribute.

For example:

auto complete

A normal input field might be like :

<input name=”name” type=”text” />

To off autocomplete just add autocomplete=”off”. That’s it.

<input name=”name” type=”text” autocomplete=”off” />

Leave a Reply

Your email address will not be published. Required fields are marked *