JSFiddle - React, Tailwind, and code Playground

HTML

<table id="your-table-id" class="ms-listviewtable">
   <tr>
      <th>table heading</th>
   </tr>
   <tr>
      <td>table body</td>
   </tr>
</table>

JavaScript

var $table = $('#your-table-id');

    // This gets the first <tr> within the table, and remembers it here.
    var $headRow = $('tr', $table).first();
    $headRow.remove();

    if (!$table.has('tbody')) {
        var $otherRows = $('tr', $table);
        $otherRows.remove();

        var $tbody = $('<tbody>');
        $table.append($tbody);
        $tbody.append($otherRows);
    }

    var $thead = $('<thead>');
    $table.prepend($thead);
    $thead.append($headRow);