I have 3 <section>
s on a page with the class .slider
and within these there are several <article>
s. For the purpose of making these work as tabbed content I want to use jQuery to hide all but the first of each these <article>
s.
The following:
$(".slider > article:not(:first)").hide();
hides everything but the first <article>
in the first <section>
, I need it to iterate through the three <section>
s and hide the first in each of these. I assume I need to use each()
to loop through them, but I can't make anything work.
$(".slider > article:not(:first-child)").hide();
如果不是第一个孩子,则可以执行此操作。
$(".slider").find("article:not(:first)").hide();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.