A few things:
1.  Why do you need return true in the function?
2.  "13" is not a valid ID,
3.  you should probably be appending the row to a tbody, not the table.

Nevertheless, I just tried your first function and it seemed to work fine for me:

http://jsbin.com/ideju/edit

Does that work for you?


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 23, 2009, at 10:11 PM, rivkadr wrote:


Am getting bloody from beating my head against the wall. I just want
to be able to change the id of a table row that is cloned and appended
to a table. This shouldn't be so hard, no?

Here's what I've tried:

function addTableRow(table)
{
        var clonedRow = jQuery(table + " tr:last").clone().attr({ id:
'13' }) ;
        jQuery(table).append(clonedRow);
   return true;
}

OR

function addTableRow(table)
{
        var clonedRow = jQuery(table + " tr:last").clone();
        jQuery(clonedRow).attr("id", "13");  //yes, I want the id to be 13
        jQuery(table).append(clonedRow);
   return true;
}

Neither of the above works. Anyone got any help they can give me,
please?

Reply via email to