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
精彩评论