技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> CSS/HTML --> 阻止Firefox缓存input的值

阻止Firefox缓存input的值

浏览:1268次  出处信息

在Firefox里面input的值会被缓存起来,刷新页面之后,会恢复成刷新之前的值。有的时候我们并不希望这么做,可以用autocomplete=”off”来阻止Firefox的默认机制。

比如下面的代码,在刷新页面之后input的值全部为空。

以下是代码片段:
<form>
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
</form>

为了方便也可以这样写:

以下是代码片段:
<form autocomplete="off">
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
</form>

QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
<< 前一篇:用CSS禁用输入法
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1