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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:59:47+00:00 2026-05-24T09:59:47+00:00

I do want to be clickable to its link the parent menu after it

  • 0

I do want to be clickable to its link the parent menu after it show the sub menu,how can it this be done below are my codes

My HTML

        <ul id="menu">
            <li>
                <a href="http://stackoverflow.com/questions/ask">Menu 1 1</a>
                <ul>
                    <li><a href="http://yahoo.com/">Menu 1 Sub</a></li>
                </ul>
            </li>

            <li>
                <a href="http://stackoverflow.com/">Menu 2</a>
                <ul>
                    <li><a href="http://google.com/">Menu 2 Sub 1</a></li>
                    <li><a href="http://wiki.com/">Menu 2 Sub 2</a></li>
                </ul>
            </li>

       </ul>

My CSS

ul#menu, ul#menu ul {
  list-style-type:none;
  margin: 0;
  padding: 0;
  width:220px;
}

ul#menu a { font:bold 12px Arial, Helvetica, sans-serif;
  display: block;
  text-decoration: none;    
}

ul#menu li {
  margin-top: 1px;
}

ul#menu li a {
  background: #1c3f94;
  color: #fff;    
  padding: 0.5em;
}

ul#menu li a:hover {
  background: #000;
}

ul#menu li ul li a {
  background: #ccc;
  color: #000;
  padding-left: 20px;
}

ul#menu li ul li a:hover {
  background: #aaa;
  border-left: 5px #000 solid;
  padding-left: 15px;
}

My JS

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();});

LIVE DEMO

  • 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-24T09:59:48+00:00Added an answer on May 24, 2026 at 9:59 am

    Don’t return false when the first condition is true:

    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 true;
            }
            if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                $('#menu ul:visible').slideUp('normal');
                checkElement.slideDown('normal');
                return false;
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have done stuff like this before, but I want to figure out the
Here's my situation. I want to recognize Markdown for a link (in this case
I want to increase the clickable area of my button (ImageView). But I don't
I want to make several parts of text individually clickable for example in the
I've got some Buttons that I want to make un-clickable (but still appear on
I have a clickable linear layout that I've generated programmaticly, and I want it
On an Android View, I want to have a some clickable text that works
How to grey out a checkbox? I want a checkbox to be clickable only
Want to run javascript function from parent window in child window Example I have
I am making my TextView clickable and want the text to change as I

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.