多數瀏覽器默認會緩存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" autocomplete="off" name="test" />
</form>