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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:31:42+00:00 2026-06-09T06:31:42+00:00

I got one HTML file containing a table: src.Html: <table id=all> <tr> <th>Row 1</th>

  • 0

I got one HTML file containing a table:

src.Html:

<table id="all">
  <tr>
    <th>Row 1</th>
    <td>Content 1</td>
  </tr>
  <tr>
    <th>Row 2</th>
    <td>Content 2</td>
  </tr>
  <tr>
    <th>Row 3</th>
    <td>Content 3</td>
  </tr>
</table>

And here is my code:

$('document').ready(function(){
    var tempTable = $('<table id="tempTable"></table>');
    tempTable.load('src.Html #all tr');
    console.log(tempTable);    --> it shows content of tempTable

    console.log($(tempTable).find('tr'));   --> it shows []

});

it’s works, and it prints the content of tempTable.

But when I want to get row based on needs, it shows nothing!
Such as:

$(tempTable).find('tr');        --> []
$(tempTable).find('tr').eq(1);  --> []
$('#tempTable tr:eq(2)')        --> []

Can anyone tell me why? Is that tempTable not a normal DOM object?

  • 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-09T06:31:45+00:00Added an answer on June 9, 2026 at 6:31 am

    I personally dislike the .load method. I’ve always been struggling with it. I don’t even know why this example doesn’t properly load and display the HTML. However, I did do some testing in there. See for yourself.

    Within the callback, it’s all fine. The callback is executed after the calls to the same functions outside of the callback. That means your content is loaded after your code, hence you receive empty arrays.

    The reason why you still are showed, in the Google Chrome Developer Tool, par example, that temp table has the children, is that you have a reference to a DOM object. I believe the difference is that the JavaScript scope is different from the DOM scope. Unlike pure JavaScript objects, every reference I’ve so far had to a DOM object is automatically updated. See in this revision. Both references to the same table show that the third row has a different content although they are called at different times.

    Concluding, all you need is a callback handler.

    Edit:

    Forget about why it wouldn’t show the contents. Of course it wouldn’t, I never updated them.

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

Sidebar

Related Questions

I've got three tables which all join into one table. Here is the code:
I've got a file notifications.js containing one event bound to an element, and a
I want a javascript code which will go through all the html file in
I got JSF Tomahawk messages and those messages got rendered as one HTML-Table. How
I've got a .php page showing a HTML table similar to this one :-
I've got one really big .java class file that has a lot of members.
I've got one function checkEvery15Seconds that runs every 15 seconds. It checks to see
Hey, I've got this nice little piece of code, much like all the other
I've got a simple HTML file upload form. I'm using the jQuery validation plugin
I'm trying to open an .html file as one big long string. This is

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.