jQuery,如何创建和删除Cookie?

问题描述

| 我有一些代码
$(document).ready(function(){  
    setTimeout(function(){
tb_show(\'yeah\',\'#TB_inline?height=490&width=534&inlineId=compare\',false);
    },13000);
});
我想要的是当此脚本运行要创建的Cookie并在4天后过期时 因此,除非Cookie过期,否则脚本不会运行。 也许使用这样的东西:
$.cookie(\"compare\",\"hello\",{ expires: 7 });
有任何想法吗? 谢谢     

解决方法

有一个jQuery插件可以做到这一点: https://github.com/carhartl/jquery-cookie