Add TR to table, then apply css to it

Add TR to table, then apply css to it

Is there a easy way to add a new TR to a table and then apply some css to it in one hit.

Like, once the new TR is appended as the last row in the table, take the new row and add a class.

Just wondering if there was a better way then using $("tr:last") twice.

  1. $(function(){
  2.         $('#donations').csv2table('docs/donations.csv', {
  3.                 sortable: false,
  4.                 onload: function(id,op,data,ary) {
  5.                     $("tr:last").after("<tr><td colspan=\"4\"><strong>Total:</strong></td><td></td></tr>");
  6.                     $("tr:last").css(cssObj)
  7.                  }
  8.              }
  9.         )
  10.     });