Ben; you are the man :D

Thank you!
L

On Aug 21, 3:13 pm, Benjamin Sterling
<benjamin.sterl...@kenzomedia.com> wrote:
> Take a look athttp://pastebin.com/mbfd5584
>
> It'll produce structure like:
>
>         <div>
>             <h2></h2>
>             <div style="width: 770px;" class="wp-caption alignnone"
>             id="attachment_762"></div>
>             <p></p>
>         </div>
>
> That should get you started.
>
> On Aug 21, 9:34 am, ldexterldesign <m...@ldexterldesign.co.uk> wrote:
>
> > No luck with thathttp://snipplr.com/view/4746/jquery--nextuntil/
> > script guys :[ Can anyone get anything working?
>
> >http://pastebin.com/m5a27bd91
>
> > The JS I need to generate is <!-- commented in --> above and below the
> > chunk of HTML.
>
> > Many thanks,
> > L
>
> > On Aug 20, 7:56 pm, ldexterldesign <m...@ldexterldesign.co.uk> wrote:
>
> > > Cheers for your help Ben. I'll crack on with this in the morning and
> > > update this post with how I get on.
>
> > > Thanks,
> > > L
>
> > > On Aug 20, 4:50 pm, Benjamin Sterling
>
> > > <benjamin.sterl...@kenzomedia.com> wrote:
> > > > lewis,
> > > > First, use pastebin.com or something like next time, it'll help us
> > > > help you.
>
> > > > So, you need to wrap each group of h2 + div + p + p.postmetadata
>
> > > > Check outhttp://snipplr.com/view/4746/jquery--nextuntil/
>
> > > > and you should be able to do something like:
>
> > > > $('h2').nextUntil('.scrollablePost').wrap('<div>')
>
> > > > If that does not work, maybe
>
> > > > $('h2')
> > > > .each(function(){
> > > > $(this).nextUntil('.scrollablePost').wrap('<div>')
>
> > > > });
>
> > > > If that still does now work, can you post your code to pastebin so I
> > > > have something work with?
>
> > > > On Aug 20, 10:55 am, ldexterldesign <m...@ldexterldesign.co.uk> wrote:
>
> > > > > 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/andput"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