Hide and Show content based on Cookie value

Posted by danit on Stack Overflow See other posts from Stack Overflow or by danit
Published on 2010-05-06T09:20:54Z Indexed on 2010/05/06 9:28 UTC
Read the original article Hit count: 143

Filed under:
|
|

Here is my Jquery:

  $("#tool").click(function() {
    $(".chelp").slideToggle();
    $("wrapper").animate({ opacity: 1.0 },200).slideToggle(200, function() {
    $("#tool img").toggle();
    });
  });

When you click #tool img #wrapper is hidden along with .chelp.

I need to control this with a cookie, so when the user hides #wrapper it remains hidden on all pages or when they re-visit the page.

I know there is a jQuery Cookie plugin, but I'd like to do this with plain Javascript rather then including another plugin.

Can anyone tell me how i can build in it in plain javascript and merge with the JQuery to create a cookie, then check the cookie each time the page loads to see if #wrapper should be hidden or displayed?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery