I’m unsure if this is classed as a child and parent div.
<div class="container">
<p>content</p>
</div>
<div class="footer"><p>content</p></div>
<div class="container">
<p>content</p>
</div>
<div class="footer"><p>content</p></div>
My CMS is putting the footer outside the post container, for each .footer I would like to move them into the closest previous .container. I hope this makes sense.
<div class="container">
<p>content 2</p>
<div class="footer"><p>content 2</p></div>
</div>
My poor attempt looks like this:
$(".container").each(function() {
$(".project_footer ")
.appendTo(".container");
});
try
.prev()assuming that the footer always comes after the container:here’s the demo