下面代碼可以保持刷新不變,但關(guān)閉頁面后打開無效<html><head><script type="text/javascript" src="/static/style/js/jquery.min.js"></script><script type="text/javascript" src="/static/style/js/jquery.cookie.js"></script><script>$(function(){$("input:checkbox").each(function(){if($.cookie($(this).attr('name'))*1==1){$(this).prop('checked','checked');}})$("input:checkbox").change(function() {if($(this).prop('checked')){$.cookie($(this).attr('name'), 1);}else{$.cookie($(this).attr('name'), 0);}});})</script></head><body><input name="c1" type="checkbox"></input> c1<br/><input name="c2" type="checkbox"></input> c2</body></html>
關(guān)于js cookie長期記住復(fù)選框狀態(tài)?
呼如林
2018-08-03 18:10:47