I am trying to generate a jquery script to make all tr elements from a table with class top clickeable and when one tr with class top is clicked all tr below with class bt until there is another tr class top will slideToggle.
I tried several things, but none is working, I think I am having some problems with my selectors.
Could anybody help?
Thanks in advance.
Also see example here
One of the scripts I created is:
<html>
<head>
<script type="text/javascript">
$("tr .top").click(function () {
$('tr .bt').nextUntil('tr:not(.bt)').slideToggle("slow");
)};
</script>
</head>
<body>
<table>
<tr class="top">
<td>top row 1</td>
<td>top row 1</td>
<td>top row 1</td>
</tr>
<tr class="bt">
<td>bt row 1</td>
<td>bt row 1</td>
<td>bt row 1</td>
</tr>
<tr class="bt">
<td>bt row 1</td>
<td>bt row 1</td>
<td>bt row 1</td>
</tr>
<tr class="bt">
<td>bt row 1</td>
<td>bt row 1</td>
<td>bt row 1</td>
</tr>
<tr class="top">
<td>top row 2</td>
<td>top row 2</td>
<td>top row 2</td>
</tr>
<tr class="bt">
<td>bt row 2</td>
<td>bt row 2</td>
<td>bt row 2</td>
</tr>
<tr class="bt">
<td>bt row 1</td>
<td>bt row 1</td>
<td>bt row 1</td>
</tr>
</table>
</body>
</html>