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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:57:28+00:00 2026-05-24T07:57:28+00:00

Due to constraints beyond the scope of this post, I need to modify some

  • 0

Due to constraints beyond the scope of this post, I need to modify some functioning jQuery to work based on the class of a list element rather than the class of an anchor tag.

Here is the current code:

<script type="text/javascript">
$(function() {
    $('#sub-nav > ul > li')
        .children('a.drop').mouseenter(function() {
            $(this).siblings('ul').toggle("slow");
            return false;
        }).end()
        .children('ul').hide();
}); 
</script>

and it worked great on this html:

<div id="subContent">
<ul>
<li><a href="nikon.html">Nikon</a></li>

<li class="cameras"><a href="#" class="drop">Cameras</a>
<ul>
<li><a href="nikon-d3x.html">Nikon D3x</a></li>
<li><a href="nikon-d3s.html">Nikon D3s</a></li>
<li><a href="nikon-d700.html">Nikon D700</a></li>
<li><a href="nikon-d300s.html">Nikon D300s</a></li>      
</ul>
</li>

<li class="lenses"><a href="#" class="drop">Lenses</a>
<ul>
<li><a href="24-70.html">Nikkor 24-70 f2.8</a></li>
<li><a href="80-200.aspx">Nikkor 80-200 f2.8</a></li> 
<li><a href="300.html">Nikkor 300 f2.8</a></li>
<li><a href="50.html">Nikkor 50 f1.4</a></li>
</ul>
</li>

<li class="bags"><a href="#" class="drop">Bags</a>
<ul>
<li><a  href="bag1.html">Small Bag</a></li>
<li><a href="bag2.html">Medium Bag</a></li>
<li><a href="bag3.html">Large Ba</a></li>
</ul>
</li> 
<li><a href="#" class="drop">Memory Cards</a></li>
</ul>
</div>

However, I need to change the parent list element, moving the class=”drop” from the <a> to the <li>:

Original: <li class="cameras"><a href="#" class="drop">Cameras</a>

New: <li class="cameras drop"><a href="#">Cameras</a>

How would I modify the jQuery to accommodate this change? Is it possible?

Thanks!

  • 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-24T07:57:28+00:00Added an answer on May 24, 2026 at 7:57 am

    this fiddle works the same as your provided code with the modification.

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

Sidebar

Related Questions

Initially my code was build/compiled using open-jdk7. But due to some constraints I now
Due to mathematica constraints I've to use the BigInteger class to represent values. After
I want to design a timer in Linux, but due to some system constraints
Due to external weird constraints I cannot modify the .gitignore of my repository. Is
Due to a number of constraints that I won't get into, I have to
Due to the lack of documentation for this on MSDN, I am forced to
Due to politics at the very large finanial institution for which I work, I
Due to network or some other reasons, some sites do not have their css
Rails 2.1.0 (Cannot upgrade for now due to several constraints) I am trying to
I'm developing an embedded application using GCC/G++ compiled for arm-eabi. Due to resource constraints,

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.