using the colon symbol in the jquery not method

I'm using the jquery .not method:

I have this jquery fiddle

On this fiddle i have this line of code.
$( "li" ).not( ":even" ).css( "background-color", "red" );

The documentation link explains this line as:
The result of this call is a red background for items 2 and 4, as they do not match the selector (recall that :even and :odd use 0-based indexing).

I'm having trouble understanding that. Because when i run this fiddle i see that item 2 and 4 are colored red.
Anyone know a more simple explanation of this line?

What does this colon symbol with the even mean?   :even
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
It's working exactly as it should - remember that :odd and :even use a zero based index so in your fiddle, Item 1 is index 0 (even), Item 2 is index 1 (odd), Item 3 is index 2 (even)

Your code colours all the odd (not even) items Red:

List Item 1 (index 0 - Even)
List Item 2 (index 1 - Odd) - RED
List Item 3 (index 2 - Even)
List Item 4 (index 3 - Odd) - RED
Chris StanyonWebDevCommented:
Also bear in mind that not even is the same as odd, and not odd is the same as even:

So these two lines do exactly the same thing:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rainer JeschorCommented:
and the colon means that this is a specific jQuery Extension and not part of the native CSS spec which normally means that performance wise these selectors are slower.



maqskywalkerAuthor Commented:
thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.