Jquery's parent child sibling node lookup sample code

  • 2020-03-30 02:10:28
  • OfStack

JQuery.parent(expr) looks for the parent node and passes in expr for filtering, such as $("span").parent() or $("span").parent(".class")

Jquery.parents (expr), similar to jquery.parents (expr), but looking for all ancestor elements, not just the parent

JQuery. Children (expr). Returns all child nodes. This method only returns direct child nodes, not all children

Jquery.contents (), which returns everything below, including the node and the text. The difference between this method and children() is that, including blank text, it is also treated as one

The jQuery object returns, and children() only returns nodes

JQuery. Prev (), returns the last sibling, not all

JQuery. PrevAll (), which returns all previous sibling nodes

JQuery. Next (), returns the next sibling, not all siblings

JQuery. NextAll (), returns all subsequent sibling nodes

JQuery. Siblings (), returns siblings(no siblings)

JQuery. Find (expr) is completely different from jquery.filter (expr). JQuery. Filter () filters out a portion of the original collection of jQuery objects, while jquery.find ()

Returns a result that does not have the contents of the initial set, such as $("p"),find("span"), from

The element starts to find, which is equal to $("p span")

Related articles: