If you can specify a parent, then you can do something like this to get children:
<div id='mydiv'>
<span>
<img/>
<img/>
</span>
<span>
<img/>
<img/>
</span>
<span>
<img/>
<img/>
</span>
</div>
Define a function like this:
function getChildren(parentId) {
var kids = Ext.get(parentId).select('*');
kids = kids.filter(function(el) {
return el.parent().id == parentId
});
return kids;
}
In your example, getChildren('mydiv').getCount()will return 3.
source
share