My goal is to initially display only the first tbody on page load, followed by showing the remaining tbody sections based on a selection in a dropdown using jQuery.
Please see below for a snippet of the code.
//custom JS to add
$("#choice").change(function() {
$("#table tbody tr").hide();
$("#table tbody tr." + $(this).val()).show('fast');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select id="choice">
<option>Choose...</option>
<option value="1Year">1 Year</option>
<option value="1.25Years">1 Year 3 Months</option>
<option value="1.5Years">1 Year 6 Months</option>
<option value="2Years">2 Years</option>
</select>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="1Year">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<tbody id="1.25Years">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<tbody id="1.5Years">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
I aim to display the initial six months of content from the calculator and allow users to view additional years by selecting an option from the dropdown menu.
Your assistance is greatly appreciated.