[jQuery] Re: Searching for the previous sibling that matches a condition

2008-12-18 Thread go_dores
FYI, my if statement was actually doing exactly what it was supposed to. The bug was inside the body of the if (I didn't post that :-(). Long story short, I was confused. Basically prev and next are smarter than I thought they were :-). For what it's worth, my updated code is below. Basically

[jQuery] Re: Searching for the previous sibling that matches a condition

2008-11-20 Thread ricardobeat
Would that be a in the way? Try putting it there yourself, this should avoid the problem: On Nov 19, 11:57 pm, go_dores <[EMAIL PROTECTED]> wrote: > First of all, I'm just getting started with jQuery so thanks in > advance for your patience.  I have a table that I am m

[jQuery] Re: Searching for the previous sibling that matches a condition

2008-11-19 Thread Karl Swedberg
Not sure if you can get any cleaner than that, but if you want to chain off of it, you could do something like this: $(theTr).filter(function() { var $this = $(this); return $this.prev('.departmentrow').length && ($this.next('.departmentrow').length || $this.is(':last-child')); }) --Karl