I have a simple problem, but for some reason I can't figure out the jQuery way to do it. Basically, all I want is to target every child (except the first one) of a group of elements.
Say, for example, one has multiple divs: <div class="myDiv"> <p>First</p> <p>Second</p> <p>Third</p> </div> <div class="myDiv"> <p>First</p> <p>Second</p> <p>Third</p> </div> And say, I want to hide every <p> except the first one of every <div>: <div class="myDiv"> <p>First</p> </div> <div class="myDiv"> <p>First</p> </div> I thought I could simply: $('div.myDiv p').not(':first').hide(); But that only acts on the first <div> and not all of them resulting in: <div class="myDiv"> <p>First</p> </div> <div class="myDiv"> <p>First</p> <p>Second</p> <p>Third</p> </div> So I thought I have to act on each <div>: $('div.myDiv').each(function(){ $('p').not(':first').hide(); }) But that only acts on the first div as well. I know it's something fundamental I missing, but for the life of me can't see it...