5 Sept 2012

An aide-memoire on setting cookies, reading cookies with jQuery

Assuming we use jquery.cookie.js, to SET a boolean cookie flag:
$.cookie("AutoShow_" + handle, isExpanding ? 'true' : 'false');
and to read it back
var shouldShow = /true/i.test($.cookie("AutoShow_" + handle));

No comments:

Post a Comment

Comments are very welcome but are moderated to prevent spam.

If I helped you out today, you can buy me a beer below. Cheers!