timkl
timkl

Reputation: 3339

Is there a way to turn off auto-complete on an input-field using jQuery?

Is there a way to turn off auto-complete on an input-field using jQuery?

Like this:

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

Upvotes: 1

Views: 702

Answers (5)

Quasipickle
Quasipickle

Reputation: 4498

"autocomplete" isn't a standard attribute. Yes it's implemented, but it's not proper XHTML.

Do you have to do it client-side? Can you make changes on the server-side if necessary?

Upvotes: 1

Buhake Sindi
Buhake Sindi

Reputation: 89169

For any text field, you could do this.

$("input[type=text]").attr("autocomplete", "off");

Hope this helps!

Upvotes: 2

Bryan Denny
Bryan Denny

Reputation: 27596

$('#id').attr('autocomplete', 'off');

Upvotes: 2

Kevin
Kevin

Reputation: 13226

$('input#id').attr('autocomplete', 'off');

You can also use a common class to turn off a group of fields. There are a few ways to do it though as you'll see from the answers.

Upvotes: 2

user57508
user57508

Reputation:

$(':text').attr('autocomplete', 'off');

Upvotes: 6

Related Questions