On 9/12/07, Glen Lipka <[EMAIL PROTECTED]> wrote: > > I am confused. Why aren't the grandchildren being included in the call > for children()? > Using $("#content *") gets all the grandkids. I thought parents() gets > all the grandparents. Is children different?
$("#content").children() is equivalent to $("#content > *") children() is a little more analogous to parent() than parents(). parent() moves the selection up one level (always 1 element, except for document/root), children() moves it down one level (0, 1, or more elements). One reason they might be/seem different is parent elements can have 0-many children, but children have at most 1 parent. So it makes sense to have a parent() that selects 0 or 1, and a parents() that returns 0 to many (all ancestors, in order from first parent to top-level/oldest ancestor). Then parents(':first') == parent(). For all descendants, you can do .find("*"). - Richard