testAddRow

by jpeter06

HTML

<table id="tabla" border="1">
<tr><td>Primera fila</td></tr>
<tr><td>Segunda fila</td></tr>
</table>

JavaScript

funtion add_new_row(table,rowcontent,clase){
 rowcontent="<tr class="+clase+">"+rowcontent+"</tr>";
 if($(table).length>0){
 	if($(table + ' > tbody').lenth==0)
  	$(table).append('<tbody/>');
    if($(table+' > tr').length>0){
    	$(table).children('tbody:last').children('tr:last').append(rowcontent);
    }else{
    	$(table).children('tbody:last').append(rowcontent);
    }
 }
}