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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:39:46+00:00 2026-05-27T18:39:46+00:00

I am working with jQuery Accordion menu, and found problems with parent and child

  • 0

I am working with jQuery Accordion menu, and found problems with parent and child navigation, and need urgent help, thanks

I expand fully of one parent menu and its child, and then click the heading in order to make it collapse. then i expand another heading, when i go back to click first heading, the child menu were not collapsing. is there a way to collapse all child heading of one parent when select another parent heading??

thanks 🙂

here is my code

<div id="accordion">
    <h3><a>Link One - First Level</a></h3>
    <div class="accordionSecond">      
        <h6><a href="#">Second Level</a></h6>
        <div class="accordionLink"> 
        <a href="1.html">1.html</a>
        <a href="2.html">2.html</a>
        <a href="3.html">3.html</a>
        <a href="4.html">4.html</a>
        </div>
    </div>

    <h3><a>Link Two - First Level</a></h3>
    <div class="accordionSecond">      
        <h6><a href="#">Second Level</a></h6>
        <div class="accordionLink"> 
        <a href="1.html">1.html</a>
        <a href="2.html">2.html</a>
        <a href="3.html">3.html</a>
        <a href="4.html">4.html</a>
        </div>
    </div>    

</div>   

here is little script line

  <script>
  $(document).ready(function() {
    $("#accordion").accordion( {active: true,  collapsible: true, header: "h3", autoHeight: false, navigation: true, event: 'mouseup'}); 
    $(".accordionSecond").accordion( {active: true,  collapsible: true, header: "h6", autoHeight: false, navigation: true,event: 'mouseup'});
  });
  </script>
  • 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-27T18:39:47+00:00Added an answer on May 27, 2026 at 6:39 pm

    You want to tap into the changestart event of the parent accordion. Here, you can collapse any child accordions:

    $("#accordion").accordion({
        active: true,
        collapsible: true,
        header: "h3",
        autoHeight: false,
        navigation: true,
        event: 'mouseup',
        changestart: function (event, ui) {
            ui.oldContent.accordion("activate", false);
        }
    });
    

    Using the activate method and passing it false tells accordion to collapse all sections.

    Example: http://jsfiddle.net/p2h8V/

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

Sidebar

Related Questions

I'm working with jQuery for the first time and need some help. I have
I have a simple accordion menu working using jQuery but I'm having trouble styling
I am working on a Jquery accordion stuff. I want to add a class
I'm working on a page using jQuery's accordion UI element . I modeled my
I'm trying to build a horizontal accordion with Jquery. It seems to be working
I'm new to jQuery. I have an accordion menu that I am trying to
I am a Jquery noob. I and am trying to create an accordion menu.
I'm using jquery + the accordion plugin. That's working great. Now, I want another
I'm using JQuery to create a Horizontal Accordion menu (based on the tutorial at
I am working with jQuery UI Accordion and it works great, but I would

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.