2010-01-08 89 views

回答

49

你想要做的是隱藏一個特定元素的所有兄弟姐妹。這是比較簡單的,使用的方法.siblings jQuery的:

​$("#exclude").siblings().hide();​​​​ 

這將隱藏在同一水平上的所有元素,在相同的父元素。

+0

+1 jQuery是輝煌! – andrewb 2013-10-03 03:59:20

7

我相信$('#target > div').not('#exclude').hide()應該做你想要什麼。

或者,如果你想分的孩子,是指div太交替,$('#target div').not('#exclude').hide()

0
$('#target').children().hide(); 
$('#exclude').show(); 
相關問題