Tutorialsteacher

Follow Us

jQuery: DOM Traversing Methods

MethodDescription
add()Creates a single jQuery object for all added elements, so that it will be easy to manipulate them at the same time.
addBack()Creates a single jQuery object for the set of selected elements by selector.
children()Get all the child elements of the selected element(s).
closest()Traversing up through its ancestors in the DOM tree untill it finds first matched element(s) specified by a selector.
contents()Gets children of all the selected element(s), including text and comment nodes.
each()Iterate over specified elements and execute specified call back function for each element.
end()End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
eq()Returns element(s) at the specified index from the selected element (return from selector).
filter()Reduce the set of matched elements to those that match the selector or pass the function's test.
find()Get all the specified child elements of each selected element(s).
first()Get the first occurrence of the specified element.
has()Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
is()Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
last()Returns last element that matched specified selector.
map()Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
next()Get the immediately following sibling of�the selected element(s).
nextAll()Get the immediately following sibling of�the selected element(s).
nextUntil()Gets all next sibling elements between two given arguments
not()Selects elements that do not match the specified selector in not() method.
offsetParent()Selects the closest ancestor element whose left and top co-ordinates are closest to matched elements by selector.
parent()Get the parent of the specified element(s).
parents()Selects all ancestor elements of the matched element(s) by a selector.
parentsUntil()Selects all the ancestor elements of the matched element(s), up to but not including the element specified in parentsUntil().
prev()Selects the immediately preceding sibling of the specified element.
prevAll()Selects all preceding siblings of each matched element, optionally filtered by a selector.
prevUntil()Selects all preceding siblings of each matched element up to but not including matched elements by selector parameter.
siblings()Get the siblings of each�specified element(s), optionally filtered by a selector.
slice()Selects elements by further filtering elements by specifying a selector parameter.