How do I wrap a repeatbale set of elements in jQuery?

Posted by Globalz on Stack Overflow See other posts from Stack Overflow or by Globalz
Published on 2010-05-05T22:49:40Z Indexed on 2010/05/05 22:58 UTC
Read the original article Hit count: 156

Filed under:
|
|
|
|

In jQuery how would I go about wrapping a repeatable set of elements with a div?

For example I have:
img
h4
p
img
h4
p
img
h4
p
I need to wrap each img, h4, p set with a div class="container". So it will look like:
<div> class="container"> img h4 p </div>
<div> class="container"> img h4 p </div>
<div> class="container"> img h4 p </div>

Any ideas on how I can achieve this as its driving me nuts! I keep getting nested div.containers! Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about wrap