开发者

jquery, how to create and delete a cookie?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜