JSFiddle - React, Tailwind, and code Playground

by denov

HTML

<table style="width: 300px;">
    <tr>
        <th>Column A</th>
        <th>Column B</th>
        <th>Column C</th>
    <tr>
        <td>Column A</td>
        <td>Column B</td>
        <td>Column C</td>
    </tr>
    <tr>
        <td>Column A</td>
        <td>Column B</td>
        <td>Column C</td>
    </tr>
</table>

JavaScript

jQuery.moveColumn = function (table, from, to) {
    var rows = jQuery('tr', table);
    var cols;
    rows.each(function() {
        cols = jQuery(this).children('th, td');
        cols.eq(from).detach().insertBefore(cols.eq(to));
    });
}

var tbl = jQuery('table');
jQuery.moveColumn(tbl, 2, 0);