views:

218

answers:

2

I'm using Jquery to add a row to the end of a table, that works fine. I want to use the JqueryUI highlight method to highlight the row whenit gets added. It works, but its not highlighting the new row, but the one above it. I'm guessing this is because i'm using the .after function to add the new row. How can I make it highlight the right row? My code looks like this

  $('#playlistTable tr:last').after(<tr><td>'text to add to table'
</td></tr>')).show('highlight',500);
+1  A: 

This is one way:

 $('#playlistTable tr:last').after("<tr><td>'text to add to table'</td></tr>"));
 $('#playlistTable tr:last').show('highlight',500);
Chris Pebble
+1  A: 

You could do this is you want to use chaining.

$("<tr><td>'text to add to table'</td></tr>").insertAfter('#playlistTable tr:last').show('highlight',500);

You can view the documentation at http://docs.jquery.com/Manipulation/insertAfter#content

Josh Bush