Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics Working with jQuery Collections jQuery-Specific Selectors

Juneau Lim
Juneau Lim
13,362 Points

Inquiry about :odd

Isn't the elements I would be select, not necessarily to be siblings? If that is the case, can I add more than one conditions for :odd?

1 Answer

Steven Parker
Steven Parker
231,261 Points

Typically, ":odd" would be combined with other selectors, but it doesn't restrict the selection to siblings in itself.

Juneau Lim
Juneau Lim
13,362 Points

What I wondered was that if I could use more than one selector with :odd. i.e) (a, li):odd or (ul li):odd(Syntax doesn't make sense but I hope it would explain what I mean.) It's very interesting. Thanks for your answer!

Steven Parker
Steven Parker
231,261 Points

Some example valid syntax rules might be:

ul li:odd {    /* odd list items inside a ul */ }
.block a:odd { /* odd links in a container with class "block" */ }
div.col:odd {  /* odd divs that also have class "col" */ }
Juneau Lim
Juneau Lim
13,362 Points

Wow thanks for the example! It seems super useful!