Here with my html and jQuery code
<div class="tabbed">
<h2>Title</h2>
<div class="tabs"></div> <!-- want to show then hide rest -->
<h2>Title</h2>
<div class="tabs"></div>
<h2>Title</h2>
<div class="tabs"></div>
</div>
<div class="tabbed">
<h2>Title</h2>
<div class="tabs"></div> <!-- want to show then hide rest -->
<h2>Title</h2>
<div class="tabs"></div>
<h2>Title</h2>
<div class="tabs"></div>
<h2>Title</h2>
<div class="tabs"></div>
</div>
<div class="tabbed">
<h2>Title</h2>
<div class="tabs"></div> <!-- want to show then hide rest -->
<h2>Title</h2>
<div class="tabs"></div>
<h2>Title</h2>
<div class="tabs"></div>
<h2>Title</h2>
<div class="tabs"></div>
</div>
jQuery
$(".tabbed > .tabs:not(:first)").hide();
Updated answer to match your new question code:
Fiddle
The above may not look “right” as one would assume that
:firstwould return only 1 element, but it has the same effect as this more verbose and CPU-consuming form:Fiddle
I assume the
.find()method does the iteration internally before executing the selector for each element in the set of matched elements, so the latter code snippet is unnecessary. However, you can use the more verbose and bulletproof form if you ever encounter problems when upgrading or downgrading jQuery in the future.