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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:36:51+00:00 2026-05-24T05:36:51+00:00

Any suggestions would be good. It is very simple but I cannot figure it

  • 0

Any suggestions would be good. It is very simple but I cannot figure it out.

I am using a simple jQuery accordion script. Here is the HTML:

<ul id="menu">
    <li>
        <a>Weblog Tools</a> <!-- THIS IS MY LINK BUTTON -->
            <ul>
                <li><a href="http://www.pivotx.net/">PivotX</a></li>
                <li><a href="http://www.wordpress.org/">WordPress</a></li>
                <li><a href="http://www.textpattern.com/">Textpattern</a></li>
                <li><a href="http://typosphere.org/">Typo</a></li>
            </ul>
    </li>
    <li>
        <a>Programming Languages</a> <!-- THIS IS MY LINK BUTTON -->
            <ul>
                <li><a href="http://www.php.net/">PHP</a></li>
                <li><a href="http://www.ruby-lang.org/en/">Ruby</a></li>
                <li><a href="http://www.python.org/">Python</a></li>
                <li><a href="http://www.perl.org/">PERL</a></li>
                <li><a href="http://java.sun.com/">Java</a></li>
                <li><a href="http://en.wikipedia.org/wiki/C_Sharp">C#</a></li>
            </ul>
     </li>
</ul>

And here is the script:

function initMenu() {
    $('#menu ul').hide();
    $('#menu ul:first').show();

    $('a.collapse').click(

function() {
    var checkElement = $(this).next();
        if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
    return false;
        }
        if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {

    $('#menu ul:visible').slideUp('normal');


        checkElement.slideDown('normal');
    return false;
            }
        });
    }

    $(document).ready(function() {initMenu();});

Nice simple script, nice and light.

This is my question, any suggestions would be amazing!

I need to get the <a>Link Button</a> in the current visible menu to be display: none and alternate between open menus.

So the idea is, when the current visible menu is open, the link that opens it has a the style display: none added to it. But all the other <a>Link Buttons</a> should be visible and not have the style display: none applied. This is so the menu can still be functional.

Only the visible open menu should have display: none.

This would be so awesome if you can help. Thanks in advance.

  • 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-24T05:36:51+00:00Added an answer on May 24, 2026 at 5:36 am

    Modify menu.js from

    function initMenu() {
      $('#menu ul').hide();
      $('#menu ul:first').show();
      $('#menu li a').click(
        function() {
          var checkElement = $(this).next();
          if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
            return false;
            }
          if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
            $('#menu ul:visible').slideUp('normal');
            checkElement.slideDown('normal');
            return false;
            }
          }
        );
      }
    $(document).ready(function() {initMenu();});
    

    To this:

    function initMenu() {
      $('#menu ul').hide();
      $('#menu li a').click(
        function() {
          var checkElement = $(this).next();
          if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
            return false;
            }
          if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
            $('#menu li a').show();
            $(this).hide();
            $('#menu ul:visible').slideUp('normal');
            checkElement.slideDown('normal');
            return false;
            }
          }
      );
    }
    $(document).ready(function() {initMenu();});
    

    I modified the first part so it won’t show the first sub menus.
    Then I added this lines so that it will show the other links, but hide the active link.

    $('#menu li a').show();
    $(this).hide();
    

    EDIT:

    You can also check a working implementation at http://jsfiddle.net/3cmPz/

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

Sidebar

Related Questions

I'm very familiar with using a transaction RDBMS, but how would I make sure
I want to respawn enemy sprites based on a timer any suggestions would be
Any suggestions on why a VB6 program would be slower when compiled than when
I am new to writing bash scripts (and not very good). So it would
Good day! I would like to have your suggestions with regards to this matter.
Does anyone know of any good tutorials for using AccountManager in android, basically what
any suggestions for a C# object pooling framework? requirements are multi-thread support and a
Any suggestions on how I can cleanup the following code pattern that repeats multiple
Any suggestions on whether fewer check constraints are better, or more? How should they
Any suggestions on the best way to display this table on an Android platform?

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.