I have divs that are being displayed via a WordPress loop.. about 60 thumbnail images that link to posts (a lot of thumbnails, I know).. and they are all in divs, obviously. 🙂 I would like to insert these divs after whichever post divs I chose… in jQuery. As far as I know, you can do something similar with insertAfter…
$('.test').insertAfter('.inner');
But I would like to insert divs after a specific number of my post divs that are being displayed via my WordPress loop.. so I would like to insert a div after the 10th, 20th, 30th, 40th and 50th post thumbnail divs.
Is this possible in jQuery, and if so how would I go about doing it?
Select the children you want (your ~60 divs):
Then, filter out every child except every nth item:
Then you can insert your
<p>after every element in the set: