Powered By Blogger

Thursday, February 7, 2019

cookie in jQuery


Set cookie
$.cookie("test", 1);
 Access cookie value : 
 $.cookie('test');
To delete:
$.removeCookie("test");
Additionally, to set a timeout of a certain number of days (10 here) on the cookie:
$.cookie("test", 1, { expires : 10 });
Should include cookie library
https://github.com/carhartl/jquery-cookie
https://github.com/carhartl/jquery-cookie/blob/master/src/jquery.cookie.js 
 

No comments:

Post a Comment