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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:25:09+00:00 2026-06-15T16:25:09+00:00

The following is basic working DropDown menu, child’s appear on parent hover. <script type=text/javascript>

  • 0

The following is basic working DropDown menu, child’s appear on parent hover.

<script type="text/javascript">
  $(document).ready(function () { 
    $('#nav li').hover(
      function () {
      //show its submenu
        $('ul', this).stop().slideDown(100);
      }, 
      function () {
      //hide its submenu
        $('ul', this).stop().slideUp(100); 
      }
    );
  });
</script>

<style type="text/css">
  #nav li {background-color:#CCC; }
</style>

<ul id="nav">
  <li><a href="#" class="selected">Parent A</a>
    <ul>
      <li><a href="#">Item a1</a></li>
      <li><a href="#" class="selected">Item a2</a></li>
      <li><a href="#">Item a3</a></li>
    </ul>
  </li>
  <li><a href="#">Parent B</a>
    <ul>
      <li><a href="#">Item b1</a></li>
      <li><a href="#">Item b2</a></li>
      <li><a href="#">Item b3</a></li>
      <li><a href="#">Item b4</a></li>
    </ul> 
  </li>
</ul>

Currently child’s appears when hover is anywhere on the area of the parent box (i.e. also outside the text, on the invisible area of the parent div).

I want the child’s to appear only on hover of the parent link (on the ‘href’ text only).

I couldn’t find the answer anywhere.

  • 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-15T16:25:10+00:00Added an answer on June 15, 2026 at 4:25 pm

    Try using the a element as target for hover instead of the entire li, as follows:

    <script type="text/javascript">
      $(document).ready(function () { 
        $('#nav ul').hide();
    
        $('#nav li > a').hover(
          function () {
          //show its submenu
            $('ul', this.parentNode).stop().slideDown(100);
          }
        );
       $('#nav li').hover(null, 
          function (e) {
          //hide its submenu
            $('ul', this.parentNode).stop().slideUp(100); 
          }
       );
      });
    </script>
    

    See working demo .

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

Sidebar

Related Questions

The following is basic working DropDown menu, child’s appear on hover the parent text.
I'm trying to get the basic lawnchair example working. The Code: <script type=text/javscript src=http://westcoastlogic.com/lawnchair/src/lawnchair.js></script>
I'm really struggling to create a valid multidimensional JavaScript array with the following basic
I have the following basic code to read a text file from a StreamReader:
I have been trying to get a basic reorderlist working following this guide ->
The following basic LINQ to SQL statement does not result in the orderby working.
Working on getting Celery setup (following the basic tutorial) with a mongodb broker as
Working on the following example in Clojure in Action (p. 63): (defn basic-item-total [price
I have the following code: function menu($parent, $level){ global $dbc; $result = $dbc->prepare('SELECT linktext,
The following basic code is working as expected. <?php mysql_connect(localhost, user, user@123) or die(mysql_error());

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.