JSFiddle - React, Tailwind, and code Playground

HTML

<table id="t">
    <tr>
        <td>a</td>
        <td>s</td>
        <td>b</td>
        <td></td>
    </tr>
    <tr>
        <td>c</td>
        <td>s</td>
        <td>d</td>
        <td>s</td>
    </tr>
    <tr>
        <td>e</td>
        <td></td>
        <td>f</td>
        <td></td>
    </tr>
</table>

CSS

table td {
    border: solid 1px red;
    width:150px;
    height:50px;
}

JavaScript

$(document).ready(function () {
    $("td:not(:empty)").each(function () {
        $(this).prev().css('background-color', 'yellow');
    });
});