I'm having a small problem in my jquery code, I wanted to do a sum in which I put the value in the input + the span value in one div and generate that in another span, but it does not show me results. p>
HTML
<div class="media-body">
<div class="menu-tittle">
</div>
<div class="quantity">
<form action="#">
<div class="pizza-add-sub">
<input type="text" class="qtdpedidos" />
</div>
</form>
</div>
<div class="pizza-price"> <span class="pizza">10.00</span>
</div>
Order Amount: $ 0.00
JQUERY
$("#somar").click(function(){
var total = 0;
var valor= $('.pizza').val());
$('.qtdpedidos').each(function(){
var valor = Number($(this).val());
if (!isNaN(valor)) total += valor;
});
total = total - desconto;
$(".resultado").html(total.toFixed(2));
});
Thank you in advance
I'm testing here link