the scope of the abbreviation search element
The three most basic filtering methods are: First (), Last (), and EQ (), which allow you to select a specific element based on its position within a set of elements.
Other filtering methods, such as filter () and not (), allow you to select elements that match or do not match a specified criterion. JQuery First () method
The first () method returns the initial element of the selected element.
The following example selects the first <p> element inside the first <div> element: an instance
$ (document). Ready (function () {
$ ("div p"). First ();
});
Try the JQuery last () method yourself
The last () method returns the final element of the selected element.
The following example selects the last <p> element in the last <div> element: instance
$ (document). Ready (function () {
$ ("div p"). Last ();
});
Try the jQuery eq () method yourself
The EQ () method returns the element with the specified index number in the selected element.
The index number starts at 0, so the first element's index number is 0 instead of 1. The following example selects the second <p> element (index number 1): instance
$ (document). Ready (function () {
$ ("P"). EQ (1);
});
Try the jQuery filter () method yourself
The filter () method allows you to specify a standard. Elements that do not match this standard are removed from the collection, and the matching elements are returned.
The following example returns all the <p> elements with the class name "Intro": instance
$ (document). Ready (function () {
$ ("P"). Filter (". Intro");
});
Try the JQuery not () method yourself
The Not () method returns all elements that do not match the criteria.
tip:The Not () method is the opposite of filter ().
The following example returns all the <p> elements without the class name "Intro": instance
$ (document). Ready (function () {
$ ("P"). Not (". Intro");
});
Try the jQuery Traversal reference manual Yourself
For all the jquery traversal methods, please visit our jquery Traversal reference manual.