$('tr[id=date-<%= @effective_from %>]').nextUntil('tr.date').remove('tr:not(.details)') .hide().addBack().first().after( '