My moreSelectors plugin has an undocumented feature that enhances
the .siblings() method to optionally return preceeding or following
siblings only.

Syntax: $(...).siblings(expr, self, prevOrNext)
 - Specify self as true to retain the current element(s) in the
results.
(default is false so that existing functionality is unaffected)
 - Specify prevOrNext as "prev" to only include previous siblings, or
"next" to only include following siblings. (Also accepts false or
true
instead of "prev" and "next" respectively) (default is "undefined" so
that existing functionality is unaffected)

To get all the LIs before a specific element you could try something
like:  $("#myLI").siblings("LI", false, "prev")

http://jquery.com/plugins/project/moreSelectors

George




> I would like a jquery selection of previous elements and current
> element included, in other words I would like [A, B, C]

Reply via email to