Hierarchy Selectors

Following are the properties of the hierarchy selectors.

Child: $("parent > child")

Child selector is used to select child elements specified by "child" of elements specified by "parent" in a document.

Descendent: $("ancestor descendant")

Descendant denotes the complete offspring proceeding from the respective ancestor. Similarly, in jQuery the descendant selector is used to select all the descendant elements in a form of a given ancestor.

Next Adjacent: $("label + input")

Next Adjacent selector is used to select the next sibling element which immediately follows a given element in a document.

Next Sibling: $("prev ~ siblings")

Next sibling selector is used to select all the next sibling elements of a given element having same parent.




Ask Questions

Ask Question