Choose the first of several instances

I have 3 <section> on the page with the .slider class, and inside them there are several <article> s. In order to make this work as tabbed content, I want to use jQuery to hide everything except the first of these <article> s.

Following:

 $(".slider > article:not(:first)").hide(); 

hides everything except the first <article> in the first <section> , I need to iterate through three <section> and hide the first in each of them. I suppose I need to use each() to scroll through them, but I can't do anything.

+4
source share
1 answer
 $(".slider > article:not(:first-child)").hide(); 

If this is not the first child, you can do it.

 $(".slider").find("article:not(:first)").hide(); 
+5
source

All Articles