find(expr|obj|ele)
Official explanation:
Return value: jQuery
Overview
Search for all elements that match the specified expression. This function is a great way to find out the descendant elements of the element being processed.
All searches rely on jQuery expressions. This expression can be written using CSS1-3 selector syntax.
Parameters
expr String
Expression used to find
jQuery object object
One used to match elements jQuery object
element DOMElement
A DOM element
Example
##Description:
HTML code:
Hello, how are you?
$("p").find("span")
#filter(expr|obj|ele|fn)
Official explanation:
Filter out the set of elements that match the specified expression.
This method is used to narrow the matching scope. Separate multiple expressions with commas
expr String
jQuery object object
Existing jQuery object to match the current element.
element Expression
A DOM element used to match elements.
function(index) Function
A function is used as a collection of test elements. It accepts a parameter index, which is the index of the element in the jQuery collection. In functions, this refers to the current DOM element.
Retain with select class Element
Hello
Hello Again
And Again
$("p").filter(".selected")
[
And Again
]The above is the detailed content of Detailed explanation of usage examples of find() and filter() operations in jQuery. For more information, please follow other related articles on the PHP Chinese website!