Based on my previous experience (such as this example), I have observed that a div
container can be easily toggled to hide and show. However, I am facing confusion when I have content inside a tr
and I wish to display and hide certain items when that tr
is clicked. Let's take the example of a food menu (let's say it's "Rice"), with various submenus under that category (like "Fried rice", "Boiled rice"...). When the "Rice" item is clicked (or if there is an arrow or plus icon to click on), the submenus should be displayed. Similarly, they should be hidden when the arrow is clicked again.
Please check out this website to see how they toggle the restaurant menu with the arrow key. I want to achieve the same functionality.
The code snippet I am currently working on is as follows:
<div class="media-right">
<table class="table">
<tr>
<td>
<a href="#"><h3 class="menu-title">Rice</h3></a>
</td> <!--make this tr expandable and collapsable-->
<td>
<div class="menu-rate">$100.00</div>
</td>
</tr>
<tr>
<td>
<a href="#"><h3 class="menu-title">Fried Rice</h3></a></td>
<td>
<div class="menu-rate">$50.00</div>
</td>
</tr>
<tr>
<td>
<a href="#"><h3 class="menu-title">Boiled Rice</h3></a></td>
<td>
<div class="menu-rate">$25.00</div>
</td>
</tr>
</table>
</div>