Here's a working example http://jsfiddle.net/MUdQY/1/
I am posting part of the solution here as well to better explain what's happening here:
$('#sometrigger').click(function(){
var newrow = '<tr class="dynamicRows">\
<td>Row 4 Column1</td>\
<td>Row 4 Column2</td>\
</tr>';
$(newrow).insertAfter($('table tr.dynamicRows:last'));
});
- We are storing the new row in a JS variable. You will have to build this string somehow.
- Using the jquery insertAfter method, which inserts the caller after the selected element.
- And the most important of all, the selector that will get the reference to the last row marked with the class dynamicRows.