4
I have this segment of code, I’d like someone to help me turn the variable P
(in which you take the attribute 'value' ) and turn it into number value for the sum.
$(document).ready(function(e) {
$('.pizzadisponivel').click(function(e){
$(this).toggleClass('pizzaselecionada');
var P = $('label').attr('value');
Total+= P;
$("#teste").html('R$' + Total);
alert(Total)
});
var Total = 0;
});
Placing the relevant HTML part makes it easier
– Miguel
Possible duplicate of jQuery doesn’t add up "+"
– Guilherme Nascimento