<div id="target">
<div id="exclude"></div>
<div></div>
...
</div>
$('#target').children().hide();
will hide all.
What you're wanting to do is hide all of the siblings of a particular element. That's relatively simple with jQuery using the .siblings
method:
$("#exclude").siblings().hide();
This will hide all elements on the same level, in the same parent element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With