I have a table like this:
<table id="tbl">
<tr><th>My Table</th></tr>
<tr><td><div class="arrow"></div></td></tr>
<tr><td>The second row</td></tr>
</table>
I want to show / hide the tr after arrow. I have written this script:
$(document).ready(function () {
$("#tbl tr:odd").addClass("odd");
$("#tbl tr:even").addClass("even");
$("#tbl tr:not(.odd)").hide();
$("#tbl tr:first-child").show();
$('.arrow').click(function () {
$(this).next("tr").toggle();
$(this).toggleClass("up");
});
});
but this cant show or hide tr. How can I solve this. Thanks