JSFiddle - React, Tailwind, and code Playground

HTML

Table version:<br/>
<table style="width:100%;">
    <tbody class="sortme">
        <tr><td>Foo</td></tr>
        <tr><td>Bar</td></tr>
        <tr><td>Really long and annoying table row, try to sort me!</td></tr>
    </tbody>
</table>
<br/>
<div style="">Div version:</div>
<div class="sortme" style="display: inline-block; width:100%;">
    <div>Foo</div>
    <div>Bar</div>
    <div>Really long and annoying table row, try to sort me!</div>
</div>

CSS

.sortme {
    background: yellow;
    width:100%;
}

JavaScript

$(document).ready(function() {
    $(".sortme").sortable({
        containment: "parent",
        tolerance: "pointer"
    }).disableSelection();
});