I have a following HTML:
<div id="div1">
<span class="icon"></span>
<span class="text"></span>
</div>
<div id="div2">
<span class="icon"></span>
<span class="text"></span>
</div>
<div id="div3">
<span class="icon"></span>
<span class="text"></span>
</div>
<div id="div4">
<span class="icon"></span>
<span class="text"></span>
</div>
Then I have some business logic in JavaScript do decide what div elements to put in array:
var arr = [];
for(i = 1; i <= 4; i++) {
if(someExpression) arr.push($("#div" + i));
}
The question: Is it possible to get all spans with class "text" from elements in arr (without using $(arr).each or for loop)?
I tried a simple things below, but they don't work..
$(arr).find(".text");
$(".text", $(arr));
$(".text", arr);
Thanks