JSFiddle - React, Tailwind, and code Playground

by xdumaine

HTML

<div class="panel">
<p>Because time is valuable, we deliver quick and easy learning.</p>
<p>At W3Schools, you can study everything you need to learn, in an accessible and handy format.</p>
</div>
 
<p class="flip">Show/Hide Panel</p>
 
<button id="fruits">Fruits</button>
<button id="veggies">Veggies</button>
<table id="foods">
  <tr class="fruits">
    <td>apple</td><td>1.00</td>
  </tr>
  <tr class="fruits">
    <td>orange</td><td>2.00</td>
  </tr>
  <tr class="veggies">
    <td>carrot</td><td>1.50</td>
  </tr>
  <tr class="veggies">
    <td>watercress</td><td>2.50</td>
  </tr>
</table>

CSS

div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
height:120px;
display:none;
}
td
{
 width:100px;   
}

JavaScript

$(document).ready(function(){
  $(".flip").click(function(){
    $(".panel").slideToggle("slow");
  });
  $("button#fruits").click(function(){
    $(".fruits").slideToggle("slow");
  });
  $("button#veggies").click(function(){
    $(".veggies").slideToggle("slow");
  });
});