:even (since jQuery 1.0) selects elements at zero-based even indices in the matched set — 0, 2, 4, …. That means the first, third, fifth, and so on. Partner of :odd.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$("tr:even"); // rows at indices 0, 2, 4 …
$("li:even"); // first, third, fifth items
$("td:even"); // even cells in document order
// Preferred today (jQuery 3.5+):
$("tr").even(); // same as :even
Call
What it does
Preceding selector
Builds the set that :even / .even filters
Indexing
0-based positions in that set (document order)
Matches
Indices where i % 2 === 0
Return value
jQuery set of even-indexed elements
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Select a set ($("tr"), $("li"), …).
Step 2
Remember: index 0 is even — the first item matches.
even → Row with Index #0, Row with Index #2
odd → Row with Index #1, Row with Index #3
How It Works
even. Indices 0 and 2.
odd. Indices 1 and 3.
Cover. Together they match every row once.
Frequently Asked Questions
:even selects elements at zero-based even indices in the matched set — 0, 2, 4, and so on. $("tr:even") matches the first, third, and fifth rows. Available since jQuery 1.0.
Because indexing starts at 0. Index 0 is even, so the first element in the set is included. Official docs call this counter-intuitive if you expect “second, fourth…” like everyday counting.
Yes — deprecated in jQuery 3.4. Official docs recommend removing :even from selectors and filtering later with .even() (jQuery 3.5.0+): $("tr").even() replaces $("tr:even").
:even keeps indices 0, 2, 4…; :odd keeps 1, 3, 5…. Together they cover the whole matched set with no overlap.
Official docs: :even is a jQuery extension and cannot use native querySelectorAll. Select with a pure CSS selector first, then use .even() (3.5+) or .filter(":even") for better performance.
No — it filters the jQuery matched set by position in that set, in document order. It is not the same as CSS :nth-child(even), which is 1-based and parent-relative.