jquery - Count child elements of "this" -


i have following html structure , want count number of input within outer foo - there might several instances of foo on 1 page, therefore want count within each instance

<div class="foo">   <div>     <input type="text...>     <label></label>     <input type="text...>     <label></label>   </div> </div> 

here's i'm trying, of course fails because this abject , div , input not

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

is there way this?

use:

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

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -