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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:29:29+00:00 2026-05-26T09:29:29+00:00

I have two dropdown hidden menus ie menu A and menu B that shows

  • 0

I have two dropdown hidden menus ie menu A and menu B that shows up when you click on link A and B respectively and vice versa and also disappears when u click anywhere in the body. The problem I have is when I click on link B whilst link A is still activated, menu A stays open instead of closing and this leads to many complications. Dunno what I am doing wrong.

you can view the code at jsFiddle demo

or here is the code am using;

html;

<ul>
<li id="tabs" class="notification">
<a>Click for Notification</a>
<div id="notification">
<h3>Your Notifications</h3>
<p>Notification #1</p>
<p>Notification #2</p>
<p>Notification #3</p>
<p>Notification #4</p>
<p>Notification #5</p>
<p>Notification #6</p>
</div>
</li>


<li id="tabs" class="latest">
<a>Click for Latest News</a>
<div id="latest">
<h3>Your Latest News</h3>
<p>News #1</p>
<p>News #2</p>
<p>News #3</p>
<p>Notification #4</p>
<p>News #5</p>
<p>News #6</p>
</div>
</li>
</ul>

jquery;

$(function() {
            $("li#tabs.notification a").click(function(e) {
                $("#notification").toggle().addClass("active");
                $('li#tabs a').removeClass('selected');
                $(this).addClass('selected');
                e.stopPropagation();
            });

            $(document).click(function(e) {
                $('#notification').hide().removeClass('active');
                $('li#tabs a').removeClass('selected');
            });

            $("#notification").click(function(e) {
                e.stopPropagation();
            });
        });


$(function() {
            $("li#tabs.latest a").click(function(e) {
                $("#latest").toggle().toggleClass("active");
                $('li#tabs a').removeClass('selected');
                $(this).addClass('selected');
                e.stopPropagation();
            });

            $(document).click(function(e) {
                $('#latest').hide().removeClass('active');
                $('li#tabs a').removeClass('selected');
            });

            $("#latest").click(function(e) {
                e.stopPropagation();
            });
        });
  • 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-26T09:29:29+00:00Added an answer on May 26, 2026 at 9:29 am

    I think the problem is about displaying and hiding correct content.

    $(function() {
            $("li#tabs.notification a").click(function(e) {
                $("#notification").toggle().toggleClass("active");
                $('#latest').hide();
                $('#notification').show();  
                $('li#tabs a').removeClass('selected');
                $(this).addClass('selected');
                e.stopPropagation();
            });
    
            $(document).click(function(e) {
                $('#notification').hide().removeClass('active');
                $('#latest').hide();              
                $('li#tabs a').removeClass('selected');
            });
    
            $("#notification").click(function(e) {
                e.stopPropagation();
            });
        });
    
    
        $(function() {
            $("li#tabs.latest a").click(function(e) {
                $("#latest").toggle().toggleClass("active");
                $('#notification').hide();
                $('#latest').show();
                $('li#tabs a').removeClass('selected');
                $(this).addClass('selected');
                e.stopPropagation();
            });
    
            $(document).click(function(e) {
                $('#latest').hide().removeClass('active');
                $('li#tabs a').removeClass('selected');
            });
    
            $("#latest").click(function(e) {
                e.stopPropagation();
            });
        });
    

    I really suggest re-thinking the solution because if you get lots of tabs then you will end up having huge amount of duplicate code.

    For example: when clicking the title it would display elements inside it and hide all the other elements. Then it would not have to know what is the Id of the div like it is now doing with #notification and #latest

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

Sidebar

Related Questions

I have two dropdown lists (one dynamically populated, the other not) that determine the
My issue is that I have two dropdown boxes that I need to align.
I have a function dropdown list. I also have two text boxes related to
I have a dropdown. I need to bind with two field of datatable value
I have a page with two ContentPlaceHolders. One has a DropDown and another UpdatePanel
I have a navigation bar that has two dropdowns (as nested ul's). I'm trying
I have two applications written in Java that communicate with each other using XML
I have two select dropdown with same classname, I will like to return the
How can i create a simple aspx page with a dropdown have two enteries
I have a page with several multiselect drop-down menus. Each menu has a general

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.