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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:48:33+00:00 2026-06-06T04:48:33+00:00

The HTML: <ul class=main_list> <li class=list_folder>One</li> <li class=list_folder>Two</li> <li class=list_folder>New list <ul class=hide_list> <li

  • 0

The HTML:

<ul class="main_list">
    <li class="list_folder">One</li>
    <li class="list_folder">Two</li>
    <li class="list_folder">New list <ul class="hide_list">
            <li class="list_folder">New one</li>
            <li class="list_folder">New Two</li>
            <li class="list_folder">Third list<ul class="hide_list">
                    <li class="list_folder">Third one</li>
                    <li class="list_folder">Third two</li>
                </ul></li>
        </ul></li>
</ul>

What I want to do: All sub lists with class of “hide_list” are hidden with CSS. When I click on li that contains the hidden list, I would like that hidden list to toggle open/close.
My jquery code:

$('.list_folder').on('click',function(){
    $(this).children('.hide_list').slideToggle();
}

The issue: it works on first sub list, but when I click on next sublist deeper it will select the next deeper list and also the outer lists, and in result the whole list will collapse.

What am i doing wrong? Any suggestions?

  • 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-06T04:48:36+00:00Added an answer on June 6, 2026 at 4:48 am
    $('.list_folder').on('click',function(e){
        e.stopImmediatePropagation();
        $(this).find('.hide_list:first').slideToggle();
    });
    

    DEMO

    Note

    You don’t need to use .children(), .find() will accomplish your job.

    .stopImmediatePropagation() keeps the rest of the handlers from being
    executed and prevents the event from bubbling up the DOM tree.

    Read more about .stopImmediatePropagation()

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

Sidebar

Related Questions

I'm working on an HTML class in PHP, so that we can keep all
I'm trying to compare two numbers, and add an HTML class to the large
I want to use the Html Helper class to build, for example, an Html.ActionLink
I am absolutely new to the MVC application.I want a dropdown list on my
I have problem with adding class to every list element. This is example html:
class x{ public static void main(String[] args){ String x=<html><head></head></html>; String arr[]=x.split(<head>); String script=hi; x=arr[0]+<head>+script+arr[1];
i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
Well, I got something like this: HTML: <div id="main" class="underline" >Hello</div> JavaScript: $('div').live('click', function(){
I have a HTML document with the below setup: <div class=main-div style=padding: 5px; border:
Is there any html form class(text box) that does not allow null values. The

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.