: Https://github.com/carhartl/jquery-cookie
Jquery.cookie How to use:
To create a temporary cookie:
$. Cookie (' name' value');
Create a cookie that has a validity period of 7 days:
$. Cookie (' name' value', {expires7});
Create a cookie with a path that has a validity period of 7 days:
$. Cookie (' name' value', {expires7, Path'/'});
Read cookies:
$. Cookie (' name//= ' value ' $ '. Cookie (' nothing//' = undefined
Read all cookies in the browser:
$. //+ = {"Name": "Value"}
To delete a cookie:
Returns True when Cookie is successfully deleted, otherwise False$.removecookie (' Name‘);= True$.removecookie (' Nothing‘);//= False//need to use the same attributes (path, domain) as what the cookie W As written with$. cookie ( ' Name ", "Value", {path: '/}); //this won ' t Work!$.removecookie ( ' name //= False//this would work!$.removecookie (", {path: ///= True
Note:when Deleting a cookie, must pass the exact same path, domain and secure options that were used to set the C Ookie, unless you ' re relying on the default options. This passage is self-translating
Jquery.cookie plug-in official and use method