Using js of jquery operation Cookie method description


Cookie manipulation is a feature that we often use in Web development, and we used to implement it through javascript. The following jquery plug-in is designed for cookie manipulation

, including the addition of cookies, clear, read… You can download it from the plugin’s home page: When the jquery file and the plug-in file are referenced in the page, you can do the following:

Set the cookie Set a cookie with the name blog and the value css9.net: $. Cookies (” blog ”, “css9.net”); Set a cookie with the name blog and the value css9.net, and set the expires property to 7 days: Cookie (“blog”, “css9.net”, {expires: 7}); Set a cookie with the name blog and the value css9.net, set the expires property to 7 days, same as

Set the cookie’s path attribute as “/admin” when $. Cookies (” blog ”, “css9.net”, {path: ’/ admin’ expires, 7}); Read the cookies: Read the cookie value named blog: Alert ($. Cookies (” blog ”)); Delete the cookies: $. Cookies (” example ”, null); There is a more detailed explanation in the downloaded js file