Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:02:55+00:00 2026-05-16T23:02:55+00:00

I have found a great tutorial on how to show and hide a certain

  • 0

I have found a great tutorial on how to show and hide a certain div on a page. I got the code working fine, but I would like to extend is to that the show/hide is remembered on page loads. I’ve looked for a solution jQuery cookie was the answer.. if I’d knew how to write the actual code that is.. Here’s the current snippet:

<script type="text/javascript">
jQuery(document).ready(function() {
 // hides the group_desciption as soon as the DOM is ready
 // (a little sooner than page load)
  jQuery('#group_desciption').hide();
 // shows the group_desciption on clicking the noted link
  jQuery('a#slick-show').click(function() {
 jQuery('#group_desciption').show('slow');
 return false;
  });
 // hides the group_desciption on clicking the noted link
  jQuery('a#slick-hide').click(function() {
 jQuery('#group_desciption').hide('fast');
 return false;
  });
 // toggles the group_desciption on clicking the noted link
  jQuery('a#slick-toggle').click(function() {
 jQuery('#group_desciption').toggle(400);
 return false;
  });
});</script>

Any idea how I can add the cookies to remember the selection from the user? A code sample would be great since I’m still trying to grasp jQuery/Javascript in general 🙂

Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:02:56+00:00Added an answer on May 16, 2026 at 11:02 pm

    Should be pretty easy. When you show the div add some code like:

    jQuery.cookie('show_desc', 'yep');
    

    …and when you hide the div:

    jQuery.cookie('show_desc', 'nope');
    

    …and then at the top of your code where you’ve got:

    jQuery('#group_desciption').hide();
    

    …change it to:

    var shouldShow = jQuery.cookie('show_desc') == 'yep';
    if( shouldShow ) { jQuery('#group_desciption').show(); }
    else {             jQuery('#group_desciption').hide(); }
    

    Or, alternatively:

    jQuery('#group_desciption')[jQuery.cookie('show_desc') == 'yep' ? 'show' : 'hide']();
    

    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found a few libraries to edit MP3 tags (UltraID3Lib is great) but
I'm using Lawrence Philips Double-Metaphone algorithm with great success, but I have found the
I have found this great tutorial, about uploading files with a Flex app, using
I have just found this great tutorial as it is something that I need.
I have found jQuery to be a great tool to simplify my MVC Views.
I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not
I have found ASP.Net PageMethods very handy and easy to use, but I have
I've been reading up on SqlTransactions and have found a great load of examples
I have found that my HTML is, to be honest, very clunky. Small, simple
I have found some libraries or web services in PHP that does the job.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.