How to hide all children of a container except a specific one using jQuery?
<div id="container开发者_Python百科">
<div id="specific_one">..</div>
...
</div>
I want to hide all children of #container
except #specific_one
, how to do that?
have you tried something like:
$('#container *:not(#specific_one)').hide();
or
$('#container').children(':not(#specific_one)').hide();
and I think this one is faster...
$('#container #specific_one').siblings().hide(); //please comment on this guys...
$('#container').children().not('#specific_one').hide();
精彩评论