JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

This table should have just one column:

<table style="width: 100%;">
    <tr>
        <td>x</td>
    </tr>
    <tr>
        <td>x</td>
    </tr>
</table>

CSS

td {
    background-color: lightgray;
}

JavaScript

var cells = $("td");

// first row -> works as expected
cells[0].style.display = "none";
cells[0].style.display = "table-cell";

// second row -> width() on hidden cell shifts it to the right
cells[1].style.display = "none";
cells.width();
cells.eq(1).show();