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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:11:03+00:00 2026-06-10T01:11:03+00:00

I have a simple accordion-style menu which opens/closes its children with a help of

  • 0

I have a simple accordion-style menu which opens/closes its children with a help of jQuery: jsFiddle.

If I click on menu items everything works fine – children of selected items are displayed, while all other unnecessary children items hide. However, I’d like to be able to open menu tree based on some variable passed (id).

So, in this jsFiddle I created manual links (on right side) which should show corresponding item in menu (expand all parents) and hide all others. I managed to toggle only first-level children when clicked on manual links, but when I click on let’s say 4th-level link (cat 11 in my example), nothing happens. What I’d like to do is to expand all parents of selected item and collapse all other which are not in selected child’s the tree path.

Thanks for helping.

  • 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-10T01:11:05+00:00Added an answer on June 10, 2026 at 1:11 am

    I think this jsFiddle does what you want.

    I haven’t tested with any more levels than your original fiddle had, but I think all of the parent, sibling, and “cousin” elements are accounted for and toggled appropriately depending on what the user clicks.

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

Sidebar

Related Questions

I have a simple accordion menu using jQuery. When I click a link inside
I have a real simple jQuery accordion based on http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/ Everything works fine but
I have a simple jQuery script to show/hide list elements accordion-style along with a
I'm using jQuery and have managed to paste together a simple accordion which can
Hi i have a simple accordion set up with jQuery with the HTML structure
I am new to Jquery but have written a simple vertical accordion. It seems
I have a simple jquery vertical accordion and would like to have different font
I have simple class with width and height member fields which define number of
I have a simple accordion setup, with just two sections. The top, first section
I'm looking to go away from our current according style menu and use jquery

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.