SETTING AND GETTING COOKIES WITH JQUERY


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $("#divid").toggle(function() {
  2. $("#divid ul").slideUp("slow");
  3. $.cookie('cookie_name', 'position');
  4. },
  5. function () {
  6. $("#divid ul").slideDown("slow");
  7. $.cookie('cookie_name', 'position2');
  8. });
  9. // cookie
  10. var cookie_name = $.cookie('cookie_name');
  11. // Set the user's selection for the right column
  12. if (cookie_name == 'position') {
  13. $("#divid ul").hide();
  14. };

URL: http://www.vagrantradio.com/2009/10/getting-and-setting-cookies-with-jquery.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.