Traversing


Traversing

jQuery is a strong utility that provides several DOM cross-checking methods for randomly and sequentially selecting items in a document. Most DOM Traversal methods do not affect the object of jQuery and are used to filter elements out based on certain requirements from the content.

Filtering out Elements

The filter method can filter all elements from the matched elements set that do not match the selector (s). You can write the selector with any selector syntax.

Locating Descendant Elements

You can choose all the descendants of a given element type by using the find(selector) method. You can write the selector with any selector syntax.

JQuery DOM Filter Methods

The table below shows helpful methods to filter certain elements out from a DOM list :

Sr.No. Method & Description
01 eq( index )
The number of matching items should be reduced to just one.
02 filter( selector )
Removes all items from the matched elements that do not match the provided selector (s).
03 filter( fn )
Removes all elements from the collection of matched elements that do not match the function specified.
04 is( selector )
Returns true if the supplied selector has at least one element in place and checks the current selection for an expression.
05 map( callback )
Convert a collection of objects into a jQuery array of values (which may, or may not contain elements).
06 not( selector )
Items that match the specified selector are removed from the list of matched elements.
07 slice( start, [end] )
Selects a subset of the elements that have been matched.