I don't see anywhere in the code where you're setting an ID to the
<tr>. And if you're cloning an existing <tr> that has an ID, that may
cause issues because IDs are suppose to be unique on a page.
Is there any reason you're cloning an existing <tr></tr> instead of
just appending it in with all the other <td> content?
Having <tr></tr> by itself is not valid because it has no <td> in it,
and might cause display issues.

On Jul 13, 12:34 pm, Nate <nathanle...@gmail.com> wrote:
> I have a table that is dynamically populated by PHP and MySQL.
>
> At the bottom, I've created an empty table row: <tr></tr>
>
> I have a jQuery function that posts data to a PHP file.  When the PHP
> file returns "true", I want it to clone that emtpy table row, and then
> manipulate it by giving the table row an ID.
>
> For example, that empty table row would clone (creating an additional
> empty table row for future use), and then look like <tr
> id="group34"><td>data here</td></tr>
>
> Here's the jQuery I have now, however, it creates the <tr> with no ID:
>
> $.post("addgroup.php", { groupname:f.groupname },
>     function(data){
>     $("#groups tr:last")
>     .clone(true)
>     .insertAfter("#groups tr:last")
>     .fadeIn("fast")
>     .html('<td><span>'+
>     '<a href="javascript:;" alt="Modify" title="Modify"
> class="editgroup" onclick="editGroup(' + data.id + ');">'+
>     '<img src="images/icons/pencil.png" /></a>'+
>     '<a href="javascript:;" alt="Remove" title="Remove"
> class="deletegroup" onclick="deleteGroup('+data.id+');">'+
>     '<img src="images/icons/cross.png" /></a></span>'+
>     '<span id="groupid' + data.id + '"><span class="gname">' +
> data.groupname + '</span></span></td>')
>
> }, 'json');
>
>

Reply via email to