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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -