using the colon symbol in the jquery not method

I'm using the jquery .not method: http://api.jquery.com/not/

I have this jquery fiddle

https://jsfiddle.net/1amxyumg/

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
LVL 1
maqskywalkerAsked:
Who is Participating?
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
0
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:

$("li").not(":even")
$("li:odd")
0

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:
Hi,
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.

Samples:
:nth-child(x)
:even
:odd
:not
:Input
:button
:eq
...

See https://api.jquery.com/category/selectors/jquery-selector-extensions/

HTH
Rainer
0
maqskywalkerAuthor Commented:
thank you.
0
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
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.