开发者

jquery, how to create and delete a cookie?

开发者 https://www.devze.com 2023-03-08 15:43 出处:网络
i have some code: $(document).ready(function(){ setTimeout(function(){ tb_show(\'yeah\', \'#TB_inline?height=490&width=534&inlineId=compare\', false);

i have some code:

$(document).ready(function(){  
    setTimeout(function(){
tb_show('yeah', '#TB_inline?height=490&width=534&inlineId=compare', false);
    },13000);
});

what i want is when this script runs a cookie to be created and to expire in 4 days so that the script wont run unless the cookie has expired.

maybe use something like this:

$.cookie("compare", "hello", { expires: 7 开发者_StackOverflow社区});

any ideas?

thanks


There is a jQuery plugin that does exactly that:

https://github.com/carhartl/jquery-cookie

0

精彩评论

暂无评论...
验证码 换一张
取 消