May 07, 2021 jQuery
The three most basic filtering methods are first(), last() and eq(), which allow you to select a particular element based on its position in a set of elements.
Other filtering methods, such as filter() and not(), allow you to pick elements that match or do not match a specified standard.
The first() method returns the first element of the selected element.
Here's an example of picking the first element inside the first .
The last() method returns the last element of the selected element.
The following example selects the last one in the last element of the .lt;p>
The eq() method returns an element in the selected element with the specified index number.
The index number starts at 0, so the index number of the first element is 0 instead of 1. The following example picks the second element (index number 1):
The filter() method allows you to set a standard. Elements that do not match this standard are removed from the collection and matching elements are returned.
The following example returns all the elements with the class name "intro":
The not() method returns all elements that do not match the standard.
Tip: The not() method is the opposite of filter().
The following example returns all the elements without the class name "intro":