[jQuery] Re: select next n "somethings"

2009-01-22 Thread Joe
This: var preBefore = $('p:eq(3)').prev('pre').text(); Only grabs the text of the preceding text contained within the tag. If you need all the tags prior, then use prevAll() http://docs.jquery.com/Traversing/prevAll Joe http://www.subprint.com On Jan 19, 5:03 pm, JLundell wrote: > Thanks

[jQuery] Re: select next n "somethings"

2009-01-22 Thread Ricardo Tomasi
Yeah, 'prox' should be 'n'. I got the wrong version of the script, here is the proper one: $.fn.until = function(end){ var n = this.next(), h = []; while( n[0] && !n.is(end) ) { h.push(n[0]); n = n.next(); } return this.add(h); }; $('nada') or was there to create an

[jQuery] Re: select next n "somethings"

2009-01-21 Thread JLundell
RIcardo, Thanks. Removing the .r and properly (I think) installing nextUntil as a plugin (that was part of my problem) made it work for Mac FF3, but not for Safari, which still complains about an undefined symbol. Unfortunately, the symbol isn't specified in the log, an the line number reference

[jQuery] Re: select next n "somethings"

2009-01-19 Thread Ricardo Tomasi
Hmm. No idea what that 'r' property was. Changing that line to if ( jQuery.filter( expr, [i] ).length ) break; seems to fix it. or use this: $.fn.until = function(end){ end = $(end)[0]; var n = this.next(), h = $('nada'); while( n[0] != end ) { h = h.add(prox); n =

[jQuery] Re: select next n "somethings"

2009-01-19 Thread JLundell
Well, almost. I'm getting an undefined on this line, I think on the length call: if ( jQuery.filter( expr, [i] ).r.length ) break;

[jQuery] Re: select next n "somethings"

2009-01-19 Thread JLundell
Thanks, guys. nextUntil() looks like what I need. Joe, am I right that your suggestion grabs all the following pre's? I need to stop on the first following non-pre.

[jQuery] Re: select next n "somethings"

2009-01-19 Thread Ricardo Tomasi
Or, if you don't mind getting all following siblings, regardless if there are other elements in the way: $(this).nextAll('pre'); On Jan 19, 7:02 pm, Ricardo Tomasi wrote: > enter nextUntil plugin by John Resig: > > $.fn.nextUntil = function(expr) { >    var match = []; > >    // We need to fig

[jQuery] Re: select next n "somethings"

2009-01-19 Thread Ricardo Tomasi
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 ) {

[jQuery] Re: select next n "somethings"

2009-01-19 Thread Joe
Here ya go: http://www.w3.org/1999/xhtml"; xml:lang="en-us" lang="en" dir="ltr"> http://ajax.googleapis.com/ ajax/libs/jquery/1.3/jquery.min.js"> $(function(){ var preBefore = $('p:eq(3)').prev('pre').text();