Day 020 - Find


In Day 018, you looked at how to select children, but what if you wanted to select all specific elements?

In this instance the .find method comes in handy.

Take this example:

$('ul.three').find('li').css('color', 'fuchsia');

Here, you'll call jQuery, search for a ul with a class of three, then find all the li elements and apply a CSS colour value.

If you take a look at this demo. Using the children method, CSS only gets applied to the children. Using find, the CSS gets applied to all the li.

Hoorar!