If you want to get specific elements through hierarchical relationships between DOM elements, such as descendant elements, child elements, neighboring elements, sibling elements, and so on, you need to use a hierarchy selector.
1,ancestor descendant
usage : $ ("form input"); return value collection element
Description: Matches all descendant elements under a given ancestor element. This is to be said below the "parent> child" area separate.
2 , Parent > Child
usage : $ ("form > Input"); return value collection element
Description: Matches all child elements under the given parent element. Note: To distinguish between descendants and child elements
3,prev + next
usage : $ ("label + input"); return value collection element
Description: Matches all next elements immediately following the Prev element
4,prev ~ siblings
usage : $ ("form ~ input"); return value collection element
Description: Matches all siblings elements after the Prev element. Note: The element that is after the match , does not contain the element, and siblings matches the elements of the prev sibling, whose descendants are not matched.
Note : ("prev ~ div") Selectors can only select the # prev " Elements behind the sibling elements ; and JQuery the methods in siblings () independent of front and back position , as long as it Peer Node You can choose
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Dark Horse DAY16 jquery& hierarchy Selector