How to automatically group/wrap n elements with a div?
I've got a list of paragraphs like so:
- <p>...</p>
- <p>...</p>
- <p>...</p>
- <p>...</p>
- <p>...</p>
- <p>...</p>
- <p>...</p>
I want to get jQuery to group 3 paragraphs with a div like this:
- <div>
- <p>...</p>
- <p>...</p>
- <p>...</p>
- </div>
- <div>
- <p>...</p>
- <p>...</p>
- <p>...</p>
- </div>
- <div>
- <p>...</p>
- </div>
The last div will simply contain the remainder number of paragraphs. Appreciate your help, thanks!