The child combinatorparent > child (since jQuery 1.0) selects only direct children of a parent. It is a more specific form of the descendant combinator (parent child), which matches at any nesting depth. Official docs call it a standard CSS combinator.
Remember
$("ul.topnav > li") // direct li only
$("ul.topnav li") // every li inside (any depth)
$("div > span") // spans that are immediate children
$("nav > ul > li > a") // chain one level at a time
// Equivalent traversal: $(parent).children(child)
Name the parent, then the child type you want at the next level only.
Write a parent selector (id, class, or tag) on the left of >.
Write a child selector on the right — only matching immediate children are kept.
Chain more > steps when you need a fixed depth (e.g. nav > ul > li > a).
Prefer > over a space when nested markup could match too many elements.
If you already have a jQuery set, .children() does the same job as a method.
Piece
Required?
Role
parent
Yes
Any valid selector for the parent elements
>
Yes
Child combinator (direct children only)
child
Yes
Filter applied to each parent’s immediate children
Return value
—
jQuery collection of matching child elements
Pseudocode
Pseudocode
matches = []
for each parentElement matching "parent":
for each childElement of parentElement.children: // first level only
if childElement matches "child":
matches.add(childElement)
return matches
// Contrast — descendant (space):
// walk ALL nested descendants, not just .children
Reference
Cheat Sheet
Keep these facts handy when choosing between > and a space.
Topic
Detail
Syntax
$("parent > child")
Since
jQuery 1.0 · CSS standard
Depth
First-level children only
vs space
parent child = any depth
Chain
a > b > c = one level per step
Method twin
$(parent).children(child)
Empty set
No direct match → length 0
Whitespace
Spaces around > are optional
Try it
Live Preview
Run ul.topnav > li vs ul.topnav li on the same nested list and compare match counts.
Sample menu
Item 1
Item 2
Nested item 1
Nested item 2
Nested item 3
Item 3
Same idea as the official jQuery ul.topnav > li demo — nested items are skipped by >.
Combinator.> keeps only that ul’s immediate li children.
Skip. Nested li elements under the inner ul do not match.
Result. Three top-level items are selected — same as the official demo.
Example 2 — Child vs Descendant Count
Same markup, two selectors — see how depth changes the match count.
jQuery
var direct = $("ul.topnav > li").length;
var all = $("ul.topnav li").length;
$("#out").text(
"Direct children (>): " + direct + "\n" +
"All descendants (space): " + all
);
Main rows: Row 1, Row 2
All tr in table: 3
(Nested row is excluded by >)
How It Works
Path.table.data > tbody > tr requires each step to be a direct child.
Outer rows. Both main data rows match.
Nested. A tr inside an inner table is not a child of the outer tbody.
Why it matters. Tables-in-tables are a classic place where a space selector over-matches.
Edge Cases & Pitfalls
Check these before relying on > in nested layouts.
depth
Space vs >
parent child walks every level. parent > child stops at the first. Menus and nested tables are common false-match sources.
text
Text nodes are not elements
Whitespace or plain text between tags is not a child element. > only considers element children.
wrapper
Extra wrappers break the chain
If markup adds a div between nav and ul, nav > ul returns empty. Inspect the real DOM tree first.
method
.children() is the method twin
Prefer .children() when you already hold a jQuery object and want to filter its direct children without rebuilding a full selector string.
Compatibility
Browser Support
The parent > child combinator is standard CSS and has been in jQuery since 1.0. It works wherever your jQuery build runs.
✓ Stable · CSS · jQuery 1.0+
jQuery parent > child
Supported across jQuery 1.x, 2.x, and 3.x in every browser that runs your jQuery build. Prefer current jQuery 3.x for modern projects.
100%CSS combinator support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
parent > childUniversal
Bottom line: Safe everywhere jQuery runs. Prefer a specific parent (id/class) so the query stays fast and readable.
Analysis
Performance Notes
Approach
Cost
Best for
$("#id > child")
Cheapest
Known container + direct children
$("ul.menu > li")
Cheap
Typical menus and lists
$("div span") (deep)
Higher
Only when any depth is required
$(el).children()
Cheap
Already holding a jQuery object
> is usually cheaper than a deep descendant walk because it only inspects first-level children. Start from a specific parent when you can.
Remember
Key Takeaways
Role:parent > child matches direct children only.
vs space: a space matches any depth — use it only when you mean that.
Chain:a > b > c walks one fixed level per step.
Method: pair with .children() when you already have a set.
One line: use parent > child when you mean “one level down” — not every nested match.
Frequently Asked Questions
The child combinator (parent > child) selects only direct children of a parent. $("ul.topnav > li") matches top-level list items inside ul.topnav, but not li elements nested inside a sub-list.
A space is the descendant combinator — it matches at any nesting depth. The > combinator matches only first-level children. $("div span") finds every span inside div; $("div > span") finds only spans that are immediate children of div.
Yes. $("nav > ul > li > a") walks one level at a time — a direct ul under nav, that ul’s direct li children, and each li’s direct a children. Use this when you need a precise depth.
Both target direct children. $("parent > child") is a CSS selector string for one-shot queries. .children("child") is a traversal method — useful when you already have a jQuery object and want its immediate children.
Yes. The > combinator is standard CSS (Selectors Level 3) and has been in jQuery since 1.0. Prefer specific parents like $("ul.topnav > li") over overly broad queries.
Use > when nested markup could cause false matches — menus with sub-menus, tables inside tables, or cards with inner wrappers. Direct-child selection keeps the query precise.