I have an HTML table that has rows something like this:
<tr class='department'><td>...</td><td>...</td></tr>
<tr><td>..</td><td>..</td></tr>
<tr><td>..</td><td>..</td></tr>
<tr><td>..</td><td>..</td></tr>
<tr><td>..</td><td>..</td></tr>
<tr class='departmentTotals'><td>...</td><td>...</td></tr>
I'd like to toggle the middle four rows when the top row is clicked.
Right now I am thinking I can loop through the rows using $(this).next('tr') until I get to the departmentTotals class, but is there a simple selector for this?
You can use the nextUntil method:
$(this).nextUntil('.departmentTotals')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With