1,JS Get node:
Parent: ParentNode Gets the parent node of the known node.
Sub: childNodes; Get all child nodes children get all child nodes FirstChild get the first child node LastChild get the last child node brother: PreviousSibling Get the previous node of a known node nextSibling get The next node of the known node 2,JQ gets the node: Parent: $ (' # '). Parent () Gets the parents at the previous level. $ (' #items '). Parents ('. Parent1 ') gets which level of parent node is available. $ (' li:parent ') Sub: $ (' #test span ') using the filter criteria $ (' #test '). Find () uses find () $ (' #test '). Children (") using the Children () function Brother: $ (' # Test '). Siblings () returns the sibling node, not before or after $ (' #test '). Prevall () returns all previous sibling nodes $ (' #test '). Prev () returns the previous sibling node, not all sibling nodes $ (' #test ') . Next () returns the next sibling node, not all of the sibling nodes $ (' #test '). Nextall () returns all subsequent sibling nodes
JS and JQ get parent, brother, child node