Wrap every 3 divs in a new div
How can I wrap every 3 divs in a new div? So If I have;
div1
div2
div3
div4
div5
div6
I need this to become;
<div>
div1
div2
div3
</div>
<div>
div4
div5
div6
</div>
I also need this to wrap the last div(s), even if their are less than 3 so this;
div1
div2
div3
div4
div5
div6
div7
Would become;
<div>
div1
div2
div3
</div>
<div>
div4
div5
div6
</div>
<div>
div7
</div>