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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:42:38+00:00 2026-05-22T01:42:38+00:00

I am looping through some unordered lists and I’d like to get all of

  • 0

I am looping through some unordered lists and I’d like to get all of the descendants by using only the saved selectors (both of which are wrapped with jquery objects).

Here is my sample HTML:

<ul>
    <li><a href="#">item 1</a></li>
    <li><a href="#">item 2</a></li>
    <li><a href="#">item 3</a></li>
    <li><a href="#">item 4</a></li>
    <li><a href="#">item 5</a></li>
</ul>

<ul>
    <li><a href="#">item 6</a></li>
    <li><a href="#">item 7</a></li>
    <li><a href="#">item 8</a></li>
    <li><a href="#">item 9</a></li>
    <li><a href="#">item 10</a></li>
</ul>

<ul>
    <li><a href="#">item 11</a></li>
    <li><a href="#">item 12</a></li>
    <li><a href="#">item 13</a></li>
    <li><a href="#">item 14</a></li>
    <li><a href="#">item 15</a></li>
</ul>

<ul>
    <li><a href="#">item 16</a></li>
    <li><a href="#">item 17</a></li>
    <li><a href="#">item 18</a></li>
    <li><a href="#">item 19</a></li>
    <li><a href="#">item 20</a></li>
</ul>

Here is my sample JS:

$(document).ready(function() {

    allUls   = $('ul');
    allAs    = allUls.find('a');

    // shouldn't this next line get all anchors within the second unordered list?
    console.log( allUls.eq(1).find(allAs) );

});

So there it is. I was expecting for an array of anchors that are descendants of the second list to be sent to the console. But that’s not the case.

You can see for yourself on my jsfiddle example: http://jsfiddle.net/u6uf4/

I’m also open to any “better” solutions you may have. Just keep in mind, I’d like to use only the saved selectors and would like to avoid creating any new selectors for this task.

Thank you for your time and effort for helping a fellow Jquery-er!

  • 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-22T01:42:38+00:00Added an answer on May 22, 2026 at 1:42 am

    The option to pass a jQuery object to find() was only recently added in version 1.6. Your jsfiddle example uses version 1.5.2. Select the latest jQuery version on the left to make it work.

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

Sidebar

Related Questions

I'm looping through a list of items, and I'd like to get a request
I'm basically looping through all the entries to check whether some entries is to
Looking through some code I came across the following code trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto)); and I'd like
I wonder if anyone could suggest the best way of looping through all the
Im looping through some XML nodes, and say i have between 1 and 200
Im having some trouble looping through some xml data. The xml file is structured
I'm looping through Some xml in .net and assigning Xml elements to string variables.
So I am looping through some objects and initializing a Dictionary> object. So first
I am looping through all my databases and aggregating the results into an aggregates
I was just looking through some information about Google's protocol buffers data interchange format.

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.