find

英[faɪnd] 美[faɪnd]

v.find;discover;find out;discover

n.find something ;The person who was discovered

jquery find() method syntax

Function: The find() method obtains the descendants of each element in the current element collection and filters them by selector, jQuery object or element.

Syntax: .find(selector)

Parameters:

ParameterDescription
selector String value, containing the selector expression for matching the current set of elements.

Description: If given a jQuery object that represents a collection of DOM elements, the .find() method allows us to search for these elements in the DOM tree. descendants and constructs a new jQuery object with the matching elements. The .find() method is similar to the .children() method, except that it only traverses a single level down the DOM tree. The first obvious feature of the .find() method is that it accepts a selector expression of the same type as the expression we passed to the $() function. Elements will be filtered by testing whether they match the expression.

jquery find() method example

<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
</head>

<body>
  <p><span>Hello</span>, how are you?</p>
  <p>Me? I'm <span>good</span>.</p>

<script>
  $("p").find("span").css('color','red');
</script>

</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance