JSFiddle - React, Tailwind, and code Playground
by Kelly Hawker
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<table class="staff">
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
</tr>
</tbody>
</table>
JavaScript
$("table.staff td").each(function (index) {
var odd = isOdd((index + 1));
if (odd) {
$("table.staff tbody").append($("<tr>"));
}
$("table.staff tr").last().append($(this));
});
$("table.staff tr").first().remove();
function isOdd(num) {
return num % 2;
}