Posted By

vagrantradio on 02/16/10


Tagged

jquery cookies


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

pauloc
jfherring
wattsupnow
Priestd09


SETTING AND GETTING COOKIES WITH JQUERY


 / Published in: jQuery
 

URL: http://www.vagrantradio.com/2009/10/getting-and-setting-cookies-with-jquery.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. };

Report this snippet  

You need to login to post a comment.