JSFiddle - React, Tailwind, and code Playground

by master1991

HTML

<table id="tableid" border="1">
  <tr class="click"><td>a</td></tr>
  <tr><td>b</td></tr>
  <tr><td>c</td></tr>
  <tr><td>d</td></tr>
</table>

<button class="click">Hide</button>

JavaScript

$(function() {
        $('.click').click(function() {
            if ($('#tableid tr:last-child').is(':visible') === true) {
                $('#tableid tr:not(:first-child)').hide();
                //$(this).text('Show');
            } else {
                $('#tableid tr:not(:first-child)').show();
                //$(this).text('Hide');
            }
        });
    });