HTML禁止清除input文本框输入缓存

多数浏览器默认会缓存input的值,只有使用ctl+F5强制刷新的才可以清除缓存记录。
如果不想让浏览器缓存input的值,有2种方法:

方法一:
在不想使用缓存的input中添加 autocomplete="off";
eg):
<input type="text" autocomplete="off" name="test" />

方法二:
在 input 所在的form标签中添加 autocomplete="off";
eg):
<form action="#" autocomplete="off">
<input type="text" name="test" />
</form>

相关文章:

  • 2021-11-30
  • 2021-04-13
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-06-21
  • 2021-11-29
  • 2021-09-14
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案