JSFiddle - React, Tailwind, and code Playground

by Akash Sharma

HTML

<button id="3">3 Days</button>
<button id="7">Week</button>
<div id="table">
    <table>
    <thead>
    <tr>
        <th>Column 1</th>
        <th>Column 2</th>
        <th>Column 3</th>
        <th>Column 4</th>
        <th>Column 5</th>
        <th>Column 6</th>
        <th>Column 7</th>
   </tr>
 </thead>
 <tbody >
  
          <tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td><td>Cell 4</td><td>Cell 5</td><td>Cell 6</td><td>Cell 7</td></tr>

 </tbody>
      
 </table>
 </div>

JavaScript

$("table").hide();
$("#3").click(function(){
    $("table").show();
    $("th:gt(2)").hide();  
    $("td:gt(2)").hide();  
});

$("#7").click(function(){
     $("table").show();
    $("th:lt(7)").show();  
    $("td:lt(7)").show();  
});