filter vs find

by Juri Rudi

HTML

<div class="foo">1
  <a class="foo">2</a>
</div>
<br>
<div class="foo2">3
  <a class="foo2">4</a>
</div>

JavaScript

$('div').filter('.foo').hide(); // hides the div with the class "foo"

$('div').find('.foo2').hide(); // hides the child anchor with the class "foo"