<p>I have the following HTML node structure:</p>

<pre><code>&lt;div id="foo"&gt;
  &lt;div id="bar"&gt;&lt;/div&gt;
  &lt;div id="baz"&gt;
    &lt;div id="biz"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;span&gt;&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>How do I count the number of immediate children of <code>foo</code>, that are of type <code>div</code>? In the example above, the result should be two (<code>bar</code> and <code>baz</code>).</p>

```
```
$("#foo > div").length
```
```
Direct children of the element with the id 'foo' which are divs. Then retrieving the size of the wrapped set produced.