Q:

Add div after every element with a particular class

Is there a way to automatically insert a div into my markup after every element with a particular class?
For example;
If I have the following markup
<div class="three-col"></div>

<div class="three-col"></div>

<div class="three-col last"></div>

Is there a way to add
<div class="after-last"></div>

Automatically after the "three-col last" div?
I'm creating a Wordpress theme and I've created some column shortcodes, but as the divs are floated left, if the last column has less content than the rest, any content added after it jumps up underneath it.
Any advice would be great.
Thanks.

A:

Yes, Try .after method.
$('.three-col.last').after('<div class="after-last"></div>');

