How To Use Cookie , JQuery, Javascript?
I'm currently creating a simple todo list, I'm having a trouble with cookies. When i remove the line $.cookie(todoDescription+1, todoDescription); the button to add a task works, a
Solution 1:
Following is the description of Usage of jQuery cookie
Create session cookie:
$.cookie('the_cookie', 'the_value');
Create expiring cookie, 7 days from then:
$.cookie('the_cookie', 'the_value', { expires: 7 });
Create expiring cookie, valid across entire site:
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
Read cookie:
$.cookie('the_cookie'); // => "the_value"
$.cookie('the_cookie', { raw: true }); // => "the_value" not URL decoded
$.cookie('not_existing'); // => null
Delete cookie:
// returns false => No cookie found
// returns true => A cookie was found
$.removeCookie('the_cookie'[, options]);
Note: when deleting a cookie, you must pass the exact same path, domain and secure options that were used to set the cookie, unless you're relying on the default options that is.
Post a Comment for "How To Use Cookie , JQuery, Javascript?"