Is there a sexier way to write this jQuery selector?
- by Bears will eat you
I want to select all the children of the body element before element with id foo (which is a child of body). Since it doesn't look like there are :before() or :after() selectors, I've got it working like this:
$('body > :first').nextUntil('#foo').andSelf();
but it seems kludgy. Could this be done with fewer function calls, or more efficiently? Maybe something akin to $('body > *:before(#foo)') ?