$.cookie('keys', "11");
$.cookie('user_id', "1113", {
path: "/"
});
$.cookie('user_name', "张三", {
path: "/",
expires: 30
});
console.log($.cookie('keys'))
console.log($.cookie('user_id'))
console.log($.cookie('user_name'))
$.removeCookie('keys');
$.removeCookie('user_id',{ path: '/'});
$.removeCookie('user_name',{path: "/",expires: -1});
function clearCookie() {
var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
if (keys) {
for (var i = keys.length; i--;) {
$.removeCookie(keys[i]);
$.removeCookie(keys[i],{ path: '/'});
$.removeCookie(keys[i],{path: "/",expires: -1});
$.removeCookie(keys[i],{path: "/",domain: document.domain,expires: -1});
$.removeCookie(keys[i],{path: "/",domain: "mp.csdn.net",expires: -1});
}
}
}