jquery: using appendTo in second to last row of table

javascript, jquery

Solution

$('#mytable tr:last').before("<tr><td>new row</td></tr>")

Problem

I have a piece of the DOM that I'd like to insert into my page. Currently I'm just blindly using: ``` $(myblob).appendTo(someotherblob); ``` How do I do the same thing, but append myblob to the second to last row that is within someotherblob. someotherblob in this case is a table and I want to inject a row above the second to last one.

Original source