:odd selects elements at odd zero-based indexes in the matched set — positions 1, 3, 5… (the 2nd, 4th, 6th elements). Available since jQuery 1.0. See also :even.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$(":odd")
$("tr:odd") → indexes 1, 3, 5… in the tr set
$("tr").odd() → same idea (jQuery 3.5+)
indexes: 0 1 2 3
even odd even odd
:odd → 2nd, 4th, 6th… elements (counter-intuitive!)
:even → 1st, 3rd, 5th… elements
Call
What it does
Base selector
Builds the matched set to filter
:odd / .odd()
Keeps odd 0-based indexes
Document order
Results follow appearance in the DOM
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Select the elements you care about (tr, li, and so on).
Step 2
Filter with :odd, .filter(":odd"), or .odd().
Step 3
Remember: index 1 is the second element.
Return Value
Return Value
Description
See examples
Check the examples below for what this API returns in common cases.
jQuery Examples
Example 1 — Official Demo: tr:odd
Find odd table rows — second, fourth, and so on (jQuery API example).
odd: Row with Index #1, Row with Index #3
even: Row with Index #0, Row with Index #2
total: 4
How It Works
Odd half. Indexes 1 and 3.
Even half. Indexes 0 and 2.
No overlap. Every matched element lands in exactly one group.
Frequently Asked Questions
:odd selects elements at odd zero-based indexes in the matched set — 1, 3, 5, and so on. $("tr:odd") matches the second, fourth, and sixth rows among matched tr elements. Available since jQuery 1.0.
Indexing is 0-based. Index 1 is odd, so the second element matches. Official docs call this counter-intuitive if you expect the first row — use :even for indexes 0, 2, 4…
:odd matches 1, 3, 5… :even matches 0, 2, 4… Together they partition the matched set with no overlap.
Yes — deprecated in jQuery 3.4. Prefer $("tr").odd() (jQuery 3.5+) or $("tr").filter(":odd") instead of $("tr:odd").
:odd filters the flat jQuery matched set (0-based). CSS :nth-child(odd) counts children within each parent (1-based). They can select different nodes.
Official docs: :odd is a jQuery extension, so it cannot use querySelectorAll alone. Select with a CSS selector first, then .filter(":odd") or .odd().