<div id='pop'>
<div class='me'>first</div>
<div>
<div class='me'>second</div>
</div>
<div>
<div>
<div class='me'>third</div>
</div>
</div>
</div>
<button onclick="test()">test</button>
<div id="result"></div>
function test(){
$r = $("#pop").find(".me");
$( $r ).each(function(index) {
let num = ++index;
let htm = $("#result").html();
$("#result").html(htm + 'Номер '+num+':'+$( this ).text()+'<br>');
});
}
This Pen doesn't use any external CSS resources.