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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:34:53+00:00 2026-05-27T07:34:53+00:00

I’ve been getting a bit frustrated with jQuery on a demo I’m slapping together

  • 0

I’ve been getting a bit frustrated with jQuery on a demo I’m slapping together and was wondering if the following is just a limitation of jQuery’s selector and search methods, or I’m just using it wrong.

Here’s an example HTML block:

<div class='div_item'>
        <td class='list'>
          <dl><dt class="access_text">Div1 text1</dt></dl>
          <dl><dt class="access_text">Div1 text2</dt></dl>
          <dl><dt class="access_text">Div1 text3</dt></dl>
        </td>
</div>
<div class='div_item'>
        <td class='list'>
          <dl><dt class="access_text">Div2 text1</dt></dl>
          <dl><dt class="access_text">Div2 text2</dt></dl>
          <dl><dt class="access_text">Div2 text3</dt></dl>
        </td>
</div>

Here’s the jQuery 1.9.2 script:

$().ready(function(){
     $('.div_item'); // this is a 2 jQuery array, with no children
     $('.div_item').find('.access_text'); // This is empty, length 0, .div_item's children aren't populated. Like I was using .children()
     $('.div_item').find('.access_text').each(function() { // This doesn't work because the .div_item children aren't populated?
         alert($(this).innerText);
     }):
});

My question is, is there a reason why are the children in the $('.div_item') array objects not populated? If they’re not populated, they can’t be referenced, then can’t be .find()‘ed for properly. This is where I think my usage is the problem.

All the suggestions I’ve seen so far work for a flatter DOM. e.g. <div class='div_item'><dt class="access_text"></dt></div>, but not for something that’s further nested.

  • 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-27T07:34:54+00:00Added an answer on May 27, 2026 at 7:34 am

    Ok!!! If anyone is curious and thought I’ve been crazy all this time, try testing it yourself. The above jQuery + the updated HTML sample WITH wrapping tags!

    I was testing the divs within a table and it probably found a gap in the DOM parsing. I know that div’s aren’t supposed to be inserted in between and it’s elements, but I never expected it to surprise me like this!

    Here’s the bad html that’s fail the jQuery find: (no child elements)

    <table>
        <div class='div_item'>
            <tr>
                <td class='list'>
                  <dl><dt class="access_text">Div1 text1</dt></dl>
                  <dl><dt class="access_text">Div1 text2</dt></dl>
                  <dl><dt class="access_text">Div1 text3</dt></dl>
                </td>
            </tr>
        </div>
    </table>
    

    Here’s how I adjusted it to work with jQuery:

    <table>
            <tr class='div_item'>
                <td class='list'>
                  <dl><dt class="access_text">Div1 text1</dt></dl>
                      <dl><dt class="access_text">Div1 text2</dt></dl>
                  <dl><dt class="access_text">Div1 text3</dt></dl>
                </td>
            </tr>
    </table>
    

    The tr class is now found by the query. In the previous case, the div’s children weren’t populated, but the div’s themselves were returned.

    Very tricky…

    Note that this was a sample and was adapted from my other work, so I appologize if there were any confusing typos.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.