<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
var a=[];
$('span.text').each(function(i){
a[i]=$(this).text();
});
a=a.join(",")
alert(a)
});
</script>
<span class="text">1</span><br />
<span class="text-notext">adad</span><br />
<span class="text">2</span><br />
<span class="text-notext">adad</span><br />
<span class="text">3</span><br />
<span class="text">4</span>