Q:

Count child elements of "this"

I have the following html structure and want to count number of input within outer foo - there might be several instances of foo on one page, therefore I want to count within each instance
<div class="foo">
  <div>
    <input type="text...>
    <label></label>
    <input type="text...>
    <label></label>
  </div>
</div>

Here's what I'm trying, but of course it fails because this is an abject and div and input are not
$(".foo").each( function () {
  console.log( $(this > div > input).length );
})

Is there a way to do this?

A:

Use:
$(".foo").each( function () {
  console.log( $(this).find('> div > input').length );
});

