jQuery 1.2 looks to have a prevUntil() function planned.
http://docs.jquery.com/JQuery_1.2_Roadmap#.nextUntil.28.29_.2F_.prevUntil.28.29
There's a sample for nextUntil there... copy it and change it for your
needs?
Pat
On Aug 6, 11:44 am, DaveG <[EMAIL PROTECTED]> wrote:
> On Mon, 6 Aug 2007 08:14:28 -0700, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> > It would help if you put up a skeleton page somewhere to demonstrate the
> > challenge.
> > :)
>
> Good point. Unfortunately, I can't do that right now, but here's a skeleton
> of the issue:
>
> <h2 id="h2a" class="h2">Heading 2a</h2>
> <h3 id="h3a" class="h3">Heading 3a</h3>
> <h3 id="h3b" class="h3">Heading 3b</h3>
> <h2 id="h2b" class="h2">Heading 2b</h2>
>
> In this case, I'd like to be able to do the following:
> 1] From #h2b, get the previous level 2 header (should return "#h2a").
> Note, this does not work: ('#h2b').prev('.h2')
> 2] From #h2b, get the previous level 3 header. (should return "#h3b").
> 3] From #h2b, get the first level 3 header from the previous level 2
> header (should return "#h3a").
>
> Note, that this is a 'clean' sample. The real scenario has plenty of other
> DOM objects between header levels.
>
> ~ ~ Dave