I do not understand why I can not execute the following script because I am somewhat of a layperson:
<div class="prices">
<h3>Option 1 = $<span class="sum" id="option-1">11.11</span></h3>
<h3>Option 2 = $<span class="sum" id="option-2">22.22</span></h3>
</div>
<div id="subtotal"></div>
and the script ...
$(document).ready( function() {
$('#option-1, #option-2').blur(function(){
var sum = $('#option-1').text();
var sum2 = $('#option-2').text();
if(sum == "") sum = 0;
if(sum2 == "") sum2 = 0;
var resultado = parseInt(sum) + parseInt(sum2);
$("#subtotal").text(resultado);
})
});
Or if you would have some simpler way to do this function however I need to specify each div.