【发布时间】:2011-09-09 17:55:14
【问题描述】:
我可以通过检查值就好了。但是当我取消选中它时,该值为 null 并且不会覆盖 cookie。你有什么推荐的?
$("input[name=box]").change(function(e) {
$.cookie("autoplay", $(e.target).val());
window.location.reload();
});
和html
<input type="checkbox" name="box" value="1">
解决方案:
$.cookie("autoplay", this.checked);
我只是用它来追踪真假。
【问题讨论】:
-
当复选框被取消选中时,应该向cookie写入什么?
'null'或0,或 ..?
标签: javascript ajax jquery checkbox