Obetener Valores Div V2

by Martin Miranda

HTML

<div class="added">
    <div><span data-value="1">Valor 1: Texto 1</span></div>
    <div><span data-value="2">Valor 2: Texto 2</span></div>
    <div><span data-value="3">Valor 1: Texto 3</span></div>
    <div><span data-value="4">Valor 2: Texto 4</span></div>
</div>

JavaScript

total = $(".added div").length;
elementos = [];
$('.added>div').each(function(){
    elem = $(this).text();
    elementos.push(elem);
    alert(elementos);
});