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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:01:45+00:00 2026-05-30T19:01:45+00:00

I am reading a table row from one page, and then trying to put

  • 0

I am reading a table row from one page, and then trying to put the cell contents into various elements on a second page. I have it sort of working, but I’d like to (a) do it properly, and (b) get rid of the extra tags I’ve picked up.
So my method is….

$(document).ready(function() {
  $(function(){
    $('#result_row').load('schedule.html #schedule_list tr:eq(1)',function(){
        var date = $('td:eq(0)',this);
        $('#date').html(date);
        var title = $('td:eq(0)',this);
        $('#title').html(title);
        var speaker = $('td:eq(0)',this);
        $('#speaker').html(speaker);
    });             
  }); 
});

and then I have
<div class= "upcoming">
Next Talk: <span id="speaker"></span> - <span id="title"></span> (<span id="date"></span>)
</div>
<span id="result_row"></span>

So this works to a point but I have a distinct feeling I’m doing it inefficiently (or wrong) as I’m a jQuery novice. In particular, having an empty <span id="result_row"> seems incorrect. More importantly, it also imports the <td> tags into the <span> elements, which I’d like to avoid. All attempts to innerHTML failed (e.g. var date = $('td:eq(0)',this).innerHTML;

Thanks for any help,

Nick

EDIT: So now I can either do this three times

var date = $('td:eq(0)',this).text();
$('#date').text(date);

to avoid getting the <td> tags. Or I can do this

var data = $.find('td',this);
$('#date').html(data[0]);
$('#speaker').html(data[1]);
$('#title').html(data[2]);

which I think looks a lot clearer (and I assume the last three lines could be done in one). Sadly .text() doesn’t seem to work, so I’m stuck with <td>‘s in my output.

  • 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-30T19:01:47+00:00Added an answer on May 30, 2026 at 7:01 pm

    If you just want to get the data inside the tds, use .html() or .text(). eg:

    var date = $('td:eq(0)',this).html();
    

    In terms of doing it properly, loading html from a page (scraping) is rarely doing it properly. You should be getting the data from another source, such as json provided & formatted by the server etc. But if you must do it, your code looks fine to me 🙂

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

Sidebar

Related Questions

I am reading a row from a SQL Server table. One of the columns
I have a recursive function reading a table of contents of documents from a
I'm reading data from a table( from a MySQL Database) with Hibernate SQL Query.
I am in the Console environment busy reading all the rows from a table
I have many .NET processes reading messages from an SQL Server 2008 DB table
Ok, so you have something like this working. You Insert into a table from
I'm struggling with some PHP/MySQL code. I am reading from 1 table, changing some
I want to read the entire contents of a table into memory, as quickly
I have been reading about the differences between Table Variables and Temp Tables and
I am reading in CSV file and translating it to an SQL Table. The

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.