Don't you think I thought about using that straight away?

How can I wrap a group of elements in the DOM when I don't know what
elements will be there in first place. I'm aiming to wrap,
essentially, a blog post, so:

$(document).ready(function(){
        $('h2').wrap('<div class="scrollablePost"></div>');
        }); // would be fine

...but try doing this:

$(document).ready(function(){
        $('<h2><bunchOfOtherElements?>...</bunchOfOtherElements?><div
class="postmetadata"></div>').wrap('<div class="scrollablePost"></
div>');
        });

:|

Thanks,
L

On Aug 20, 3:36 pm, ak732 <ask...@gmail.com> wrote:
> go to:http://api.jquery.com/and put "wrap" in the filter box
>
> On Aug 20, 10:06 am, ldexterldesign <m...@ldexterldesign.co.uk> wrote:
>
> > Yo guys,
>
> > I need to wrap this chuck of HTML in a <div>:http://is.gd/2qatX
>
> > Any thoughts?
>
> > $(document).ready(function(){
> >         $('<div class="scrollablePost">').insertBefore('.page-id-9 h2');
> >         $('</div>').insertAfter('.page-id-9 .postmetadata');
> >         });
>
> > ...just pumps out <div class="scrollablePost" /> at both ends, as
> > you'll see from the above screenshot.
>
> > Thanks,
> > L

Reply via email to