enter nextUntil plugin by John Resig:

$.fn.nextUntil = function(expr) {
   var match = [];

   // We need to figure out which elements to push onto the array
   this.each(function(){
       // Traverse through the sibling nodes
       for( var i = this.nextSibling; i; i = i.nextSibling ) {
           // Make sure that we're only dealing with elements
           if ( i.nodeType != 1 ) continue;

           // If we find a match then we need to stop
           if ( jQuery.filter( expr, [i] ).r.length ) break;

           // Otherwise, add it on to the stack
           match.push( i );
       }
   });

   return this.pushStack( match, arguments );
};

$(this).nextUntil(':not(pre)');

btw, when is this plugin going to get added to plugins.jquery.com?

cheers,
- ricardo

On Jan 19, 5:59 pm, JLundell <jlund...@pobox.com> wrote:
> I have a page with alternating sets of one or more <p> and <pre>
> paragraphs.
>
> Given that $(this) is a <p> block, I want to select the next <pre>
> block, plus the additional <pre> blocks, if any, that follow the first
> one.
>
> How?

Reply via email to