jquery nextAll and skip first element -
i need add click event on fist child td each tr class “ toprow” toggle next tr rows class “subrow” skiping first tr under tr.toprow.
table example
<table> <tr class="toprow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="otherrow"> <td colspan="3">text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="toprow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="otherrow"> <td colspan="3">text</td> </tr> <tr class="toprow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="otherrow"> <td colspan="3">text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> <tr class="subrow"> <td>text</td> <td>text</td> <td>text</td> </tr> </table>
jquery have @ moment
$("tr.toprow td:first-child").click(function () { $(this).parent().nextuntil('tr:not(tr.subrow):gt(1)').slidetoggle(); });
anther thing tried
$("tr.toprow td:first-child").click(function () { $(this).parent().nextuntil('tr:gt(1):not(tr.subrow):gt(1)').slidetoggle(); });
but dont result required.
you can throw .next()
in there skip (which simplifies things), this:
$("tr.toprow td:first-child").click(function () { $(this).parent().next().nextuntil('tr.toprow').slidetoggle(); });
Comments
Post a Comment