开发者

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 开发者_如何学Cjavascript or jQuery.


This should work:

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

Or, on your html element:

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜