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

  • Home
  • SEARCH
  • 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 7846815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:42:59+00:00 2026-06-02T17:42:59+00:00

I am looking for some sort of jQuery click menu that will open up

  • 0

I am looking for some sort of jQuery click menu that will open up another ul if the clicked li element has children – something like this.

<ul>
    <li><a href"#">Item 1</a>
        <ul>
            <li><a href"page1.html">Item 1 child 1</a></li>
            <li><a href"page2.html">Item 1 child 2</a></li>
            <li>
                <a href"#">Item 1 child 3</a>
                <ul>
                    <li><a href"#">Item 1 child 3 child</a></li>
                </ul>
            </li>
        </ul>
    </li>
    <li><a href"page3.html">Item 2</a></li>
    <li><a href"page4.html">Item 3</a></li>
</ul>

So when I click “Item 1” it will open up the new list and if I click “Item 1 child 3” it will open yet another list and so forth and so on.

I think I once saw some about .next but I am not quite sure.

  • 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-02T17:43:01+00:00Added an answer on June 2, 2026 at 5:43 pm

    This should do what you need:

    $("a").click(function(e){
       $(this).closest("li").children("ul").toggle();
    });​
    
    $("a").click();//quick hack to hide all children to start with (if desired)
    

    See here for a working example

    Here is an example with a sliding effect (as hinted in comments)


    NOTES

    Using the .children function will mean that all “sub-expansions” will be “retained” once the parent is re-expanded – to me this seems like the natural behaviour.

    If you would prefer that closing a parent reset all sub expansions to also be closed the next time the parent is expanded, then you can use the .find method in replace of .children

    Also, it should be considered that this code will apply to all A links on the page, if you need to be more specific about which A links this applied to you should change the selector. One example to only include A links within a UL element might look like this:

    $("ul a").click(...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for some sort of a free JavaScript/JQuery graphing library that has
I'm looking for a library that will disassemble x86 code into some sort of
I'm looking for some sample code that will sort the list items in an
I'm looking for some sort of jquery plugin (or even plain javascript) that can
I am looking for some help. I have found this script that sort of
I'm looking for some sort of TimeRange widget in Javascript/CSS/jQuery. I'm not looking for
I am looking for some sort of message box that occurs at the cursor.
I'm looking for some sort of very basic privilege escalation example that I can
I'm wondering if there is some sort of element (preferably jQuery since this library
Looking for some ideas here... I have a MySQL table that has 100K rows

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.