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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:52:12+00:00 2026-05-21T08:52:12+00:00

I want jQuery slideToggle() to persist it’s state. By default when the page loads

  • 0

I want jQuery slideToggle() to persist it’s state. By default when the page loads it is collapsed. For the <div> that has the slideToggle() applied there is an asp: button, and when clicked some operation is performed, but probably a page post back occurs.

If the page is refreshed the initial state of the <div> should be visible if the user had previously clicked the slideToggle(). Similarly if the user collapses the <div> again, when the page is refreshed (either F5 or a post back) then the <div> should once again be initially collapsed.

So basically I want to know how to persist the state of slideToggle() at post back? Here is the code:

<script type="text/javascript">
    $(document).ready(function() {
        $(".flip").click(function() {
            $(".panel").slideToggle("slow");
        });
    });
</script>

<div>
    <div class="panel">
        <table>
            <tr>
                <td>First Name:</td>
                <td><asp:TextBox runat="server" Text=""></asp:TextBox></td>
            </tr>
            <tr>
                <td>Last Name:</td>
                <td><asp:TextBox ID="LastName" runat="server" Text=""></asp:TextBox></td>
            </tr>
            <tr>
                <td>Email:</td>
                <td><asp:TextBox ID="Email" runat="server" Text=""></asp:TextBox></td>
            </tr>
            <tr>
                <td>Role Name:</td>
                <td>
                    <asp:DropDownList ID="RoleName" runat="server">
                        <asp:ListItem Text="Select a role" Enabled="true" Value=""> </asp:ListItem>
                        <asp:ListItem Text="DC" Value="DC"> </asp:ListItem>
                        <asp:ListItem Text="ST" Value="ST"> </asp:ListItem>
                        <asp:ListItem Text="AD" Value="AD"> </asp:ListItem>
                        <asp:ListItem Text="CA" Value="CA"> </asp:ListItem>
                        <asp:ListItem Text="GSP" Value="GSP"> </asp:ListItem>
                        <asp:ListItem Text="GDC" Value="GDC"> </asp:ListItem>
                        <asp:ListItem Text="GST" Value="GST"> </asp:ListItem>
                        <asp:ListItem Text="GAD" Value="GAD"> </asp:ListItem>
                        <asp:ListItem Text="GCA" Value="GCA"> </asp:ListItem>
                        <asp:ListItem Text="GSP" Value="GSP"> </asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td><asp:Button ID="Addparticipant" runat="server" Text="Add Participant" /></td>
            </tr>
        </table>
    </div>
    <p class="flip">Show/Hide Panel</p>
</div>

The ASP code:

Protected Sub Addparticipant_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Addparticipant.Click
    Response.Write("Hi it work yaar")
End Sub
  • 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-21T08:52:13+00:00Added an answer on May 21, 2026 at 8:52 am

    I have created an example for you in jsfiddle on how to use cookie to save and retrive the state of your toggle http://jsfiddle.net/6KkCE/

    Javascript code:

    var panel = $(".panel"), flip = $(".flip"),
        state = $.cookie("ToggleStatus");
    
    flip.click(function() {
        panel.slideToggle("slow", function() {
            $.cookie("ToggleStatus", (state == 1? "0" : "1"));
        });
    });
    
    if ((state == 0 && panel.is(':visible'))) {
        panel.slideUp();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some thumbnails that slideToggle a hidden div. I only want one to
I want the jQuery slideToggle effect but want to use CSS3 transitions in order
I came across this great JQuery example of using a slidetoggle. I want to
JQUERY: $(li h2).click(function() { $(this).toggleClass(active).siblings().removeClass(active); $(this).next(div).slideToggle(fast).siblings(div).slideUp(fast); }); HTML: <ul> <li> <h2>headingA</h2> <div>contentA</div> <h2>headingB</h2> <div>contentB</div>
I have a set of divs that I want to make collapsible/expandable using jQuery's
I want to show first element that is hidden by jquery. my html code
I want to slideToggle a bulleted list in ASP.NET using jQuery when I click
I'm trying to use the slideToggle effect from jQuery. I want to use for
I'm new to jQuery. I'm using .slideToggle to make a DIV appear at the
I have this function $(a#<?php echo $custom_jq_settings['toggle']; ?>).click(function() { jQuery(#<?php echo $custom_jq_settings['div']; ?>).slideToggle(400); jQuery(#featurepagination).toggle();

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.