jQuery’s .find() Method

In jQuery, the .find() method is used to return descendent elements of the selected element. Basically, you can use it when you want to apply jQuery to all the descendants of a particular element. You can also do this by selecting them by classes and ids, but sometimes if there are many different classes, ids, or elements involved, this way is the simplest.

To use it, place the parent element in the selector, and pass the descendant elements you'd like to apply your jQuery to through the parameters. See how it works below:

$(".main").find("p", "a").css("font-size", "18px");

So the code in the example above will change the font-size of all of the p and a elements that are children of the .main element to 18px.

You can use this method to return as many descendants as you like, just make sure you pass them through the .find() method, place them in quotations, and separate them with a comma.

Responsive Menu
Add more content here...