JSFiddle - React, Tailwind, and code Playground

HTML

<script>
        // $("table tr td") this is being executed
        // but it doesn't exist yet
        alert("Script in head, elements: " + $("table tr td").length);
        
        // this will be executed when the element
        // loads completely
        $(function() {
            alert("Script when page loads, elements: " + $("table tr td").length);
        });
    </script>

<table>
    <tr>
        <td>change color</td>
        <td>change color</td>
        <td>change color</td>
    </tr>
</table>

    <script>
        alert("Script after the element, elements: " + $("table tr td").length);
    </script>

CSS

td { background: #aaa; cursor: pointer; padding: 2px }