-1
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>
Code jQuery:
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", "#less") work, I’m having problems.
debug in browser? I saw missing period and comma after parsefloat(pp), I saw no logic error.
– Felipe Duarte
Recommend strong mind that reads Manual on how NOT to ask questions, yours fits in at least 3 topics of the.
– Guilherme Lautert