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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:14:38+00:00 2026-06-12T16:14:38+00:00

Im trying to make an animated list that when an item is clicked, a

  • 0

Im trying to make an animated list that when an item is clicked, a child UL toggles display and becomes visible. The problem is however, when the user then clicks a child LI within the newly visible List, the display is then toggled again as opposed to the link going to a new page…

My jQuery is…

//Product range expander
$('.product-range ul li a').click(function() {
  $(this).parents("li").find("ul").toggle('slow')
  return false;
});

Markup…

<ul>
<li>
   <a href="#">United Kingdom</a>
       <ul style="display: none;">
           <li><a href="page1.html">Product</a></li>
           <li><a href="page2.html">Product</a></li>
           <li><a href="page3.html">Page</a></li>
        </ul>
</li>
</ul>
  • 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-12T16:14:39+00:00Added an answer on June 12, 2026 at 4:14 pm

    Alter your selector so it only targets the first anchor using the CSS2 child selector which only selects direct descendants.

    $('.product-range > ul > li > a').click(function(e) {
      $(this).parents("li").find("ul").toggle('slow')
      return false;
    });
    

    Your current selector applies your function to all a tags which are nested inside a li which is nested inside a ul tag regardless of depth.

    Working example here: http://jsfiddle.net/P9k9w/9/

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

Sidebar

Related Questions

I am trying to make an app that will display a bunch of different
I trying to make a simple animated menu that slides in and out but
I'm trying to make a UITableView that when a user selects a cell it
I was trying to make a list that updates from the top. Every time
I am trying to make a navigation that uses simple unordered lists to list
I am trying to make an animated clock using Swing in Java. The picture
I'm trying make a login window where a user is prompted to enter their
I'm trying make an entity with doctrine that has three associations with other entities
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
What I am trying to do is create a list of anchors that will

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.