$(".sectionHeader").click(function() {
var row = $(this).parent();
while (row.next().length != 0) {
row = row.next();
if (row.children().first().is('th')) return;
row.toggle();
}
});
$(.sectionHeader).click(function() { var row = $(this).parent(); while (row.next().length != 0) { row = row.next();
Share
It looks like you have rows in the table that are section headers, in that case, you can collapse until the next sectionHeader like this:
You could make it more efficient with
delegate()like this:This attaches one event handler for the entire table instead of 1 per
.sectionHeaderrow.