user505210
user505210

Reputation: 1402

Hiding the next to next child element using jquery

Say I have the below HTML

<div id="target">
    <div>
   <div></div>   //hide this one 
   </div>  
    ...
</div> 

How can I hide the second div .$('#target').children().hide(); will hide starting the first .

Thanks

Upvotes: 0

Views: 31

Answers (2)

Vel
Vel

Reputation: 731

And if you need to do this with css

#target > div div:first-child {display:none;}

jsfiddle

Upvotes: 0

Two-Bit Alchemist
Two-Bit Alchemist

Reputation: 18467

I guess you want:

$('#target div div').hide();

Select the div inside the div inside #target.

Upvotes: 2

Related Questions