0

I seem to have problem with my jQuery script.

$("top").append("<tr><td align='right' class='whtxt'><strong>"+this['date']+"</strong></td><td align='right' class='whtxt'><strong>"+this['name']+"</strong></td></tr>");

jumps top of the <th> tag, it should stay under there as table.

<div style="width: 100%;">
    <table width="100%" align="right">
        <tr>
            <th align="right"><h5 style="padding:0;margin:0;">One</h5></th>
            <th align="right"><h5 style="padding:0;margin:0;">Two</h5></th>
        </tr>
        <top></top>
    </table>
    </div>

---

$(document).ready(function() {
    done();
});

function done() {
    setTimeout(function() {
    updates();
    done();
    }, 200);    
}

function updates() {
    $.getJSON("include/index.php", function(data) {
        $("top").empty();

        $.each(data.result, function() {

            $("top").append("<tr><td align='right' class='whtxt'><strong>"+this['date']+"</strong></td><td align='right' class='whtxt'><strong>"+this['name']+"</strong></td></tr>");
        });
    });
}
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by AleMonteiro
0

I'd suggest you add an ID to your table and use:

$("#myTable tr:last").after("<your html>");

This will add the new row at the end of the table.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.