JSFiddle - React, Tailwind, and code Playground

HTML

<button id="dis" type="button">I'm Disabled</button>
<br/>
<br/>
<table border=1>
    <thead>
        <tr>
            <th>samp</th>
            <th>samp2</th>
            </thaed>
            <tbody> <td>samp</td>
            <td>samp2</td></tbody>
</table>
<br/>

JavaScript

document.addEventListener('DOMContentLoaded', function () {

    checkMe();


    function checkMe() {
        var tab = document.getElementsByTagName("table");
        var tbody = tab[0].getElementsByTagName("tbody");
        var tabLenth = tbody[0].getElementsByTagName("tbody").length;

        if (tabLenth == 0) {
            document.getElementById("dis").setAttribute("disabled", true);
        } else {
            document.getElementById("dis").setAttribute("disabled", false);
        }
    }

});