omg
omg

Reputation: 139982

how to hide all right siblings with jQuery?

$(this).parent().next().css('display','none');

The above only hides the sibling right next to the current one.

If there are multiple ones,will fail.

Upvotes: 3

Views: 3312

Answers (1)

nickf
nickf

Reputation: 546243

You need to use nextAll()

$(this).parent().nextAll().css('display','none');

or even better:

$(this).parent().nextAll().hide()

Upvotes: 9

Related Questions