Expand and Collapse Table Rows with jQuery
Problem:
Expand and collapse table rows when a specific header column is clicked, limiting the expansion/collapse to rows beneath the clicked header.
Proposed Solution:
Code Snippet:
<code class="javascript">$('.header').click(function() { $(this).nextUntil('tr.header').slideToggle(1000); });</code>
HTML Structure:
<code class="html"><table border="0"> <tr class="header"> <td colspan="2">Header</td> </tr> <tr> <td>data</td> <td>data</td> </tr> <tr> <td>data</td> <td>data</td> </tr> </table></code>
Additional Features:
The above is the detailed content of How to Expand and Collapse Table Rows with jQuery?. For more information, please follow other related articles on the PHP Chinese website!