Jay
Jay

Reputation: 313

clearing form history with jQuery

Is there a way I can clear the form history with jQuery.

I have a form and I can view the history of my input elements in a dropdown. I woz wondering If I can clear those input fields history with javascript or jQuery.

Upvotes: 3

Views: 2918

Answers (2)

John Strickler
John Strickler

Reputation: 25421

A new HTML5 form attribute called autocomplete should help you with this.

Use it like so:

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

Or on the entire form:

<form autocomplete="off"></form>

Remember, you can only suggest what you want the browser to do... you can't force it. As browsers begin implementing the HTML5 standard more and more then this will take effect more often. But you can begin using it now.

Upvotes: 0

Matt MacLean
Matt MacLean

Reputation: 19648

This should work:

$("#field_id").attr("autocomplete", "off");

Or, on your html element:

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

Upvotes: 2

Related Questions