PHP code with HTML:
<h2 ><?php the_title() ; ?></h2>
<ul class="galeria" >
<?php the_title() ?>
<li class="pizzadisponivel"><label value="29,99"><?php the_post_thumbnail('medium');?></label></li>
<spam> <?php the_content() ?> </spam>
<button id="mais" >+1</button>
<button id="menos" >-1</button>
</ul>
<?php
endwhile;
endif;
?>
<label id="teste"=>R$0.00</label>
<button class="col-12" id="btn" >Finalizar Compra</button>
jQuery code:
var Total = parseFloat('0');
var P = $('label').attr('value');
var Pp = (P.replace(/,/,'.'));
$('#mais').click(function(e)){
Total += parseFloat(Pp)
$("#teste").html('R$' + parseFloat(Total).toFixed(2));
});
$('#menos').click(function(e)){
Total -= parseFloat(Pp)
$("#teste").html('R$' + parseFloat(Total).toFixed(2));
});
$('#btn').click(function(){
alert('Sua compra foi finalizada.');
I have this code, I would like to make the buttons ("#more", "#menos") work, I'm having problems.