This is the current code:
$("input[name='content_use']").click(function() {
if ($(this).is(":checked")){
$(this).closest('tr').next().show();
$(this).closest('tr').next().next().show();
$(this).closest('tr').next().next().next().show();
} else{
$(this).closest('tr').next().hide();
$(this).closest('tr').next().next().hide();
$(this).closest('tr').next().next().next().hide();
}
});
😐
EDIT:
As you can see I must to use next() repeatedly to reach successive rows. How can I code this shorter?
Solution: nextUntil() Thanks to @pimvdb
Use
.nextAll— “Get all following siblings of each element in the set of matched elements”: