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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:42:24+00:00 2026-05-25T01:42:24+00:00

I am using jQuery to produce an accordion effect in a menu I have

  • 0

I am using jQuery to produce an accordion effect in a menu I have created. The menu is tabbed and uses jQuery UI Tabs and in accordance with their documentation I cannot use multiple effects on one element. As such, I have used slideUp() and slideToggle() to create the effect which works, a la <a onclick="$('ul#categories li ul').slideUp();$(this).next().slideToggle()">Subjects</a>.

However, my list has another unordered list within it and this does not get displayed. I do not want to have lots of links set to activate the slider as this gets very complex to maintain within my CMS which outputs the links as lists. An example of my code would be

<div id="member-categories">
<ul id="categories">
    <li>
        <a onclick="$('ul#categories li ul ').slideUp();$(this).next().slideToggle()">Heading 1</a>
        <ul>
            <li><a href="#">Link 1</a>
                <ul>
                    <li><a href="#">Sub-Link 1</a></li>
                    <li><a href="#">Sub-Link 2</a></li>
                    <li><a href="#">Sub-Link 3</a></li>
                    <li><a href="#">Sub-Link 4</a></li>
                </ul>
            </li>
            <li><a href="#">Link 2</a></li>
        </ul>
    </li>
    <li>
        <a onclick="$('ul#categories li ul').slideUp();$(this).next().slideToggle()">Heading 2</a>
        <ul>
            <li><a href="#">Link 1</a></li>
            <li><a href="#">Link 2</a></li>
            <li><a href="#">Link 3</a></li>
            <li><a href="#">Link 4</a></li>
            <li><a href="#">Link 5</a></li>
        </ul>
    </li>
</ul>
</div>

If I click Heading 1, only Link 1 and 2 are displayed. Clicking Heading 2 displays all links. Why is the <ul> of Link 1 in Heading 1 not displaying?

Thanks

  • 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-25T01:42:24+00:00Added an answer on May 25, 2026 at 1:42 am

    Is this something like this for you’re looking for?

    Demo

    When you’re selecting ‘#Categories li ul’ this is hiding all inner list and list items. When you use slideDown on the first unordered list, it will only show (change the display property of) its direct children (in other words, the inner list and list items are still hidden). The inner list items display property is still set to ‘display:none’. Instead if you ‘show’ each ‘ul’ then its direct children (each li) will be shown.

    Edit: Alternativly (as the demo demonstrates), you can just hide the first set of un-ordered lists.

    $('#categories').children().children('ul').slideUp();
    

    This way, the inner lists are technically still shown. So when you show the outer list, all its children are shown.

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

Sidebar

Related Questions

The Easy Accordion jQuery plugin uses CSS rotation to produce vertical accordion tabs. See:
I am using JQuery Cycle to produce a slideshow of images. The plugin uses
I'm using the Filament Group's jQuery Select Slider to produce a form for selecting
Using Jquery , I have an array result [<a href=><img src=image1></a>,<a href=><img src=image2></a>] if
I am developing a java webapp, using jsp/jquery/ejb/jboss. I have a web-form that enables
I am using jQuery tablesorter to sort a table and would like to produce
I am using jQuery 1.4.3. I have some divs that have microdata in them
I have a URL that I'm passing through a jQuery ajax call (using encodeURIComponent)
I'm using a bit of jquery to search Flickr, produce a set of thumbnails,
I have an app built using jQuery (and using various jQuery-UI tools). For some

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.