I have a few values in a few spans and I want to extract each number to a string and then perform calculations. I have the following code which will just get the value from the "example" id but how can I get the values from all the spans as well
$(function() {
$a = $('#example').text();
window.alert($a);
});
<div id="example">
<span>1</span>
<span>,</span>
<span>9</span>
<span>9</span>
<span>3</span>
<span>,</span>
<span>1</span>
</div>