title: How is the jQuery selector $('#foo a') evaluated?
body: <p>As a example of jQuery code (<a href="https://coderwall.com/p/7uchvg">https://coderwall.com/p/7uchvg</a>), I read that the expression <code>$('#foo a');</code> behaves like this:  </p>
  
  <blockquote>
    <p>Find every <code>a</code> in the page and then filter <code>a</code> inside <code>#foo</code>.</p>
  </blockquote>
  
  <p>And it does not look  efficient.</p>
  
  <p>Is that correct? And if yes, how should we do that in a better way?</p>