No jQuery tag, so I'm assuming pure JavaScript
var spanText = document.getElementById('targetSpanId').innerText;
Is what you need
But in your case:
var spans = document.getElementById('test').getElementsByTagName('span');//returns node-list of spans
for (var i=0;i
Here's a fiddle