开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜