$('tr[id=date-<%= @effective_from %>]').nextUntil('tr.primary', ':not(.date)').remove(); var columns = $('table > thead > tr > th').length; $('tr[id=date-<%= @effective_from %>]').nextUntil('tr.primary').addBack().last().after( '
' + '<%= j render partial: 'targets/edit_form' %>' + '
' );