[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-21 Thread ldexterldesign
No luck with that http://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

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-21 Thread Benjamin Sterling
Take a look at http://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

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-21 Thread ldexterldesign
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        

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread DanWellman
Hey dude, I never create and add closing elements, jQuery will usually always do this automatically. I would just do something like: $(function() { var div = $(div).addClass(scrollablePost); $('.page-od-9 .postmetadata').appendTo(div); div.insertBefore('.page-id-9 h2'); }); That would

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ldexterldesign
Cheers Dan, but that doesn't close the div class=scrollablePost properly: http://twitpic.com/el8q8 :[ L On Aug 20, 3:15 pm, DanWellman danwell...@gmail.com wrote: Hey dude, I never create and add closing elements, jQuery will usually always do this automatically. I would just do something

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ldexterldesign
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

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread Liam Potter
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:

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ak732
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

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ldexterldesign
I've asked myself this, but I'm in too deep now. It all goes back to a site structure stage believe it or not. I'm building a pretty unconventional layout from a client's design. I use progressive enhancement, so to go back into my PHP at this point would be a bad idea. Thanks, L On Aug 20,

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread Benjamin Sterling
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 out http://snipplr.com/view/4746/jquery--nextuntil/ and you should be able to do something like:

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ak732
I didn't understand from your original post that you wanted to wrap a series of elements where the series was of indeterminate length. From what you posted in reply, it looks like Benjamin's answer will work, although if I understand correctly, .postmetadata is the marker class marking the final

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ldexterldesign
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

[jQuery] Re: 'Wrapping' some (not just 1 pair) HTML elements in a div?

2009-08-20 Thread ldexterldesign
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