2010-08-16 53 views

回答

6

试试这个:

$("div:visible").not('#div1, #div1 *').hide(); 

,或者如果你只是想排除子元素div

$("div:visible").not('#div1, #div1 div').hide(); 
+0

非常感谢! – Peter 2010-08-16 07:20:13

1
$("div:visible:not(#div1)").hide(); 
$("#div1").children().show(); 
0

其实,一个孩子选择使用 “大于” 字:选择目标的所有后代

#div1 > div (all div children of div id "div1") 

空间两者之间:

#div1 div (all div descendants of div id "div1") 
相关问题