Skip to main content

Bug Tracker

Side navigation

#4875 closed enhancement (invalid)

Opened July 10, 2009 01:16AM UTC

Closed July 10, 2009 03:22PM UTC

prevAll() not including current element

Reported by: fmachs Owned by:
Priority: trivial Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc: fmachs
Blocked by: Blocking:
Description

Hi.

I came into a problem where .prevAll() required use of current element. In the current jQuery release, .prevAll() seems not including the current element.

Ex:

<div>

<a href="#"></a>

<a href="#"></a>

<a href="#"></a>

</div>

$('div a:nth-child(2)').prevAll().css('background-color', #000');

The above code would add the background-color to the <a>s before <a> 2 and would not include the <a> 2.

It would be nice to have an option of setting when to include the current element or not in the .prevAll() ( didn't tested .nextAll() ).

Attachments (0)
Change History (1)

Changed July 10, 2009 03:22PM UTC by flesler comment:1

cc: → fmachs
resolution: → invalid
status: newclosed

Just do this:

$('div a:nth-child(2)').prevAll().andSelf().css('background-color', #000');