Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

jQuery traversal method


May 07, 2021 jQuery


Table of contents


jQuery traverses the method

The jQuery traversal method can be used to filter, find, and concatenate elements.


jQuery traversal method

The table below lists all the jQuery traversal methods.

method describe
add() Add the elements to the collection of matching elements
addBack() Add previous elements to the current collection
andSelf() Was abandoned in version 1.8. ADDBACK () alias
children() Returns all direct child elements of selected elements
closest() Returns the first ancestor element of selected elements
contents() Returns all direct sub-elements of selected elements (including text and annotation nodes)
each() Perform a function for each match element
end() End the most recent screening operation in the current chain and return the matching element to the previous state
eq() Returns an element with a specified index number of selected elements
filter() Collect the matching element to match the new elements that match the selector or match the function return value
find() Returns the descendant elements of the selected elements
first() Returns the first element of the selected element
has() Returns all elements with one or more elements in it
is() Check the matching element collection according to the selector / element / jQuery object, return true if there is at least one matching element, return TRUE
last() Returns the last element of selected elements
map() Pass each element in the current match to give a function, generate a new jQuery object containing the return value
next() Returns the latter element of the selected element
nextAll() Returns all the same elements after the selected element
nextUntil() Returns all the same level elements after each element between two given parameters
not() Remove elements from matching elements
offsetParent() Returns the first positioned parent element
parent() Returns direct parent elements of selected elements
parents() Returns all ancestors of selected elements
parentsUntil() Returns all ancestors between two given parameters
prev() Returns the former class elements of selected elements
prevAll() Returns all the same elements before the selected element
prevUntil() Returns all the same level elements before each element between two given parameters
siblings() Returns all level elements of selected elements Returns All Sibling Elements of the SETETED ELEMENT
slice() Collect the matching element to the subset of the specified range

Related to the actual battle

In this site's jQuery programming battle, you can get exercises related to the jQuery traversal method!