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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:55:14+00:00 2026-05-25T10:55:14+00:00

Still getting the hang of jQuery, and I’m having a problem adding rows to

  • 0

Still getting the hang of jQuery, and I’m having a problem adding rows to a table. I got code from this link on stackoverflow, but it’s not working on IE7, which sadly is the one browser is HAS to work in.

I THINK the problem is the jQuery selector for the table, but nothing else I’ve tried has worked. Any ideas?

Some code:

<table id="payments" class="resultsGrid">
    <thead>
        <tr class="header">
            <th style="width: 45px;">Type</th>
            <th style="width: 50px;">Check #</th>
            <th style="width: 50px;">Amount</th>
            <th style="width: 50px;">Date</th>
            <th>Notes</th>
            <th style="width: 48px;"></th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

And the JS:

var table = $("#payments > tbody:last");
    table.empty();

    if (demolition.Payments != null) {
        $("#payments").show();

        for (i = 0; i < demolition.Payments.length; i++) {
            table.append("<tr>");
            // blah blah trimmed
            table.append("</tr>");
        }
    }
    else {
        table.append("<tr>");
        table.append("<td colspan=\"6\" style=\"padding: 4px;\">No payments recorded.</td>");
        table.append("</tr>");
    }
  • 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-25T10:55:14+00:00Added an answer on May 25, 2026 at 10:55 am

    Combine them into one call. Your jQuery is closing the tags and adding a row, then adding the cells outside of the row. Even Chrome displays this behavior in jsfiddle

    table.append("<tr><td colspan=\"6\" style=\"padding: 4px;\">No payments recorded.</td></tr>"); //This adds a row with its contents contained.
    

    Better yet, concatenate them to a string and add all the rows at once to reduce DOM manipulation overhead. The stringbuffer technique is less useful in modern browsers, but since you are using IE7 it may be faster than the + operator.

    var buffer = [];
    for (...){
        buffer.push("<tr>");
        buffer.push(cellOne);
        buffer.push(cellTwo);
        buffer.push(cellThree);
        buffer.push("</tr>");
    }
    
    table.append(buffer.join('')); //This speeds up string concatenation.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please bear with me on this as I'm still getting the hang on Java.
I'm still getting the hang of Rails, and I've come across a problem that
DO NOT DO THIS. This question is still getting upvotes, so I wanted to
I've come from a java background, so i'm still getting to grips with some
I thought I was getting the hang of this, then I ran into a
I'm still getting the hang of more advanced MySQL queries, so bear with me
I think i'm getting closer but still getting resource errors with this. I have
I am using this css to format two columns but I am still getting
I'm using Ubuntu 9.04 and I applied this tutorial But I'm still getting this
I have updated my code with the changes made. I am still getting incorrect

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.