http://is.gd/2qubA < basically I need to do this client-side. I've taken your advice (I normally pseudo the JS I need in HTML/PHP beforehand anyway (I'll admit I'm not as good with jQuery as some of you on here)), but on this occasion I'm working with a post loop. It's not gonna be worth my time to go hacking at that if I can solve it client-side with some jQuery.
I hope you get my drift. Thanks, L On Aug 20, 5:24 pm, Liam Potter <radioactiv...@gmail.com> wrote: > why would you be doing this with jquery anyway? > > > > > > ldexterldesign 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