I needed the same solution. Been stuck for hours trying to solve
this... I really hope this get added to the standard manipulators in a
next release and gets documented too ;)

On 16 Apr., 23:14, Claes H <claesatw...@gmail.com> wrote:
> On Thu, Mar 26, 2009 at 4:01 AM, Ricardo <ricardob...@gmail.com> wrote:
>
> > jQuery.fn.nextUntil = function(expr) {
> >   var match = [];
> >   this.each(function(){
> >       for( var i = this.nextSibling; i; i = i.nextSibling ) {
> >           if ( i.nodeType != 1 ) continue;
> >           if ( jQuery.filter( expr, [i] ).r.length ) break;
> >           match.push( i );
> >       }
> >   });
> >   return this.pushStack( match, arguments );
> > };
> > (plugin by John Resig)
>
> > $('h1').each(function(){
> >  $(this).nextUntil('h1').wrapAll('div');
> > });
>

Reply via email to