<tr class="blabla">...</tr>
<tr class="important">...</tr>
<tr class="important">...</tr>
<tr class="someclass">...</tr>
elems = $('table tr');
const $sorted = $('table tr').sort(el => $(el).hasClass('important') ? -1 : 1);
$sorted.appendTo($sorted.parent());
const $important = $('table tr.important');
$important.parent().prepend($important);