I have an invoice table. The last four rows are as follows, starting from last: Grand Total, Tax, Subtotal, Add a line link.
So I need to add a row before the "Add a link link row".
This thread Add table row in jQuery shows how to add a row after the last row. I just need to modify it, to add a row before the fourth to last row.
how about you add a class to your grand total row
<tr class="grand-total"></tr>
then in jquery you do
$('#myTable tr.grand-total').before('<tr></tr>');
this way you are not doing it based on a position that might be changing, but instead based on something meaningful like 'grand total'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With