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');