2010-08-16 52 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") 
相關問題