【jQuery】Jquery.cookie()

 1 注意:如果不设置path,默认为当前路径,新建cookie
 2 
 3 $.cookie('name', 'value');
 4 
 5 新建带限制时间cookie
 6 $.cookie('name', 'value', { expires: 7 });
 7 新建限制时间和路径cookie,
 8 $.cookie('name', 'value', { expires: 7, path: '/' });
 9 
10 
11 读取cookie
12 $.cookie('name'); // => "value"
13 $.cookie('nothing'); // => undefined
14 
15 读取所有可用cookie$.cookie(); // => { "name": "value" }
16 
17 
18 删除cookie
19 // Returns true when cookie was successfully deleted, otherwise false
20 $.removeCookie('name'); // => true
21 $.removeCookie('nothing'); // => false
22 
23 // Need to use the same attributes (path, domain) as what the cookie was written with
24 $.cookie('name', 'value', { path: '/' });
25 // This won't work!
26 $.removeCookie('name'); // => false
27 // This will work!
28 $.removeCookie('name', { path: '/' }); // => true

源:https://github.com/carhartl/jquery-cookie#readme

原文地址:https://www.cnblogs.com/oiliu/p/4727324.html