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 8193511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:30:13+00:00 2026-06-07T04:30:13+00:00

im still fairly new to jquery and i got this slideToggle container, but now

  • 0

im still fairly new to jquery and i got this slideToggle container,
but now i want to save a cookie if the container is hidden or not so
if one refreshes the page it keeps its current state.

I heard about the jquery cookie plugin but didn’t really understand it to be honest. 🙁

Can anyone help me out?

My code so far is pretty simple:

$(function(){
 $("#hideslide").click(function(){
  $(this).next().slideToggle();
 });
});

Any help is highly appreciated

  • 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-06-07T04:30:14+00:00Added an answer on June 7, 2026 at 4:30 am

    The jQuery Cookie plugin (found here) is the easiest way to use cookies with jQuery.

    To set a cookie, this will do:

    $.cookie("name", "content");
    

    Getting a cookie is just as simple:

    $.cookie("name");
    

    So you should check on page load if the cookie is set:

    if($.cookie("name") != null) {
        // Cookie set, action here
    }
    

    And on clicking the item to toggle, check if cookie is set. If it is set, remove it, else, set it:

    if($.cookie("name") != null) {
        $.cookie("name", null); (null as value will remove the cookie)
    }
    else {
        $.cookie("name", "content");
    }
    

    I use this plugin myself and this is all you need. Easy.

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

Sidebar

Related Questions

I'm still fairly new to Java, but I'm fairly sure this shouldn't happen. There's
So I am still fairly new to java. I have written this but am
I'm fairly new to jQuery still and am trying to pick up ways to
I'm still fairly new to rails so I'm not sure what I'm missing here.
I am still fairly new to parallel computing so I am not too sure
So I am still fairly new to all of this, that is coding, OS
This is kind of a unique issue, and I'm still fairly new to MVC,
I'm still fairly new to javascript and I'm not finding where I'm making my
I am still fairly new to C++/cli and am not always sure when I
I am still fairly new to jQuery so the following may seem pretty basic

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.