rodabt rodabt - 2 years ago 136
CSS Question

JQuery equivalent to hide consecutive elements

I'm building an app that needs to hide consecutive rows. Currently I'm using this:

#mytable tr.collpaserow + tr,
#mytable tr.collpaserow + tr + tr,
#mytable tr.collpaserow + tr + tr + tr {
display: none;
}


This allows me to hide up to 3 more consecutive rows. What I want is to hide all possible consecutive rows no matter what depth with Jquery.

Answer Source

Can you try this?

$(".collpaserow").nextAll().hide();

http://api.jquery.com/nextAll/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download