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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:54:05+00:00 2026-06-14T13:54:05+00:00

I have a simple toggle that is working perfectly, manaaged to cobble it together

  • 0

I have a simple toggle that is working perfectly, manaaged to cobble it together as know little or nothing..

The html..

<ul>
    <li id="menu-item-346" class="parents-toggle"><a href="#">Parent Button</a>

        <ul class="sub-menu">

            <li id="menu-item-347" class="parents-toggle-inner"><a href="#">Child Button</a>

            <ul class="sub-menu">
                <li id="menu-item-348" class="menu-item">Button</a></li>
                <li id="menu-item-349" class="menu-item">Button</a></li>
            </ul>
    </li>
</ul>

The jquery….

 $(".parents-toggle > a").click(function () {
         $(".parents-toggle > ul.sub-menu").not($(this).siblings()).slideUp();
         $(this).siblings(".sub-menu").slideToggle();
      });

      $(".parents-toggle-inner > a").click(function () {
         $(".parents-toggle-inner > ul.sub-menu").not($(this).siblings()).slideUp();
         $(this).siblings(".sub-menu").slideToggle();
      });

Is it possible that when you click on a button to collapse its menu an active class be added to that specific button, so as you click and the menu opens the button remains a different colour…?

  • 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-14T13:54:06+00:00Added an answer on June 14, 2026 at 1:54 pm

    Sure, just make use of jQuery’s toggleClass() function like this jsFiddle example.

    $(".parents-toggle > a").click(function() {
        $(this).toggleClass('toggled');
        $(".parents-toggle > ul.sub-menu").not($(this).siblings()).slideUp();
        $(this).siblings(".sub-menu").slideToggle();
    });
    
    $(".parents-toggle-inner > a").click(function() {
        $(this).toggleClass('toggled');
        $(".parents-toggle-inner > ul.sub-menu").not($(this).siblings()).slideUp();
        $(this).siblings(".sub-menu").slideToggle();
    });​
    

    By adding $(this).toggleClass('toggled'); to your functions you can add/remove the class as needed.

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

Sidebar

Related Questions

I am adding this simple plugin that I have working in a static html
I have a simple toggle that brings down a menu on click and hides
I have simple php validation form that is halfway working. If you leave the
I have a web application I'm working on that requires a HTML multiple select
I have simple win service, that executes few tasks periodically. How should I pass
I'm new to Jquery and I was able to put together a simple toggle
Coolio, i am working on creating a simple tree that sits as a archive
I have an ASP.NET MVC 3 application that binds data to a Model. Simple
I have a simple toggle function to show and hide content. It is triggered
I have built a simple tour on my website that will be coded using

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.