jQuery traversal functions include methods for filtering, finding, and concatenating elements.

jQuery traversal functions include methods for filtering, finding, and concatenating elements.

Function Description
.add() Adds an element to the set of matched elements.
.andSelf() adds the previous set of elements on the stack to the current set.
.children() gets all children of each element in the set of matched elements.
.closest() starts from the element itself, works its way up to the next element, and returns the ancestor that matched first.
.contents() gets the children of each element in the set of matched elements, including text and comment nodes.
.each() iterates over the jQuery object, executing a function for each matched element.
.end() ends the most recent filter operation in the current chain and returns the set of matched elements to the previous state.
.eq() reduces the set of matched elements to a new element at the specified index.
.filter() reduces the set of matched elements to new elements that match the selector or the return value of the function.
.find() Gets the descendants of each element in the current set of matched elements, filtered by the selector.
.first() reduces the set of matched elements to the first element in the set.
.has() reduces the set of matched elements to a set containing the descendants of a particular element.
.is() checks the current set of matching elements against the selector and returns true if there is at least one matching element.
.last() reduces the set of matched elements to the last element in the set.
.map() passes each element in the current matched set to the function, producing a new jQuery object containing the return value.
.next() Gets the immediate sibling elements of each element in the set of matched elements.
.nextAll() Gets all sibling elements after each element in the set of matched elements, filtered by the selector.
nextUntil() Gets all sibling elements after each element until an element matching the selector is encountered.
.not() removes an element from the set of matched elements.
.offsetParent() gets the first parent element for positioning.
.parent() Gets the parent element of each element in the current set of matched elements, filtered by the selector.
.parents() Get the ancestors of each element in the current set of matched elements, filtered by the selector.
.parentsUntil() Gets the ancestors of each element in the current set of matched elements until an element matching the selector is encountered.
.prev() Gets the immediately preceding sibling element of each element in the set of matched elements, filtered by the selector.
.prevAll() Gets all sibling elements preceding each element in the set of matched elements, filtered by the selector.
.prevUntil() gets all siblings preceding each element until an element matching the selector is encountered.
.siblings() Get the sibling elements of all elements in the set of matched elements, filtered by the selector.
.slice() reduces the set of matched elements to a subset of the specified range.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326638746&siteId=291194637