tags:

views:

97

answers:

3

Hi,

here is my code $("div:visible:not(#div1)").hide();

The Problem: the DIV-Childs from #div1 are hided too :(

kind reagards Peter

+5  A: 

Try this:

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

or if you only want to exclude children elements of type div:

$("div:visible").not('#div1, #div1 div').hide();
piquadrat
Thank you very much!
Peter
+1  A: 
$("div:visible:not(#div1)").hide();
$("#div1").children().show();
Sarfraz
A: 

Actually, a child selector uses the "greater than" character:

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

The space between two selectors targets all descendants:

#div1 div (all div descendants of div id "div1")
nush