Bug Tracker

Opened 12 years ago

Closed 12 years ago

#11031 closed feature (invalid)

.children() multiple hierarchy levels

Reported by: tsukasa1989 Owned by: tsukasa1989
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


Currently working on a project and since I do know the exact structure and I want a good performance I am using the following code (this is faster then .find()):


The code functions, but it would be better if something like this is possible, which currently returns 0 elements:

$("#moduleConatainer").children("table tbody tr")

Change History (3)

comment:1 Changed 12 years ago by dmethvin

Owner: set to tsukasa1989
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 in reply to:  1 Changed 12 years ago by tsukasa1989

Status: pendingnew

I have a fiddle here: http://jsfiddle.net/FrKyN/163/

Running this code:

console.log("children('div').children('label') length: " + $("#container").children("div").children("label").length);

console.log("children('div label') length: " + $("#container").children("div label").length);

On this HTML:

<div id="container">


children('div').children('label') length: 1
children('div label') length: 0

comment:3 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed


Read the selector from right to left. You're selecting labels below #container and there are none. Followups to http://forum.jquery.com.

Last edited 12 years ago by dmethvin (previous) (diff)
Note: See TracTickets for help on using tickets.