-1
Good afternoon!
I have the following form,
<input type="hidden" id="id_rifa" name="id_rifa" value="qaa">
<input type="hidden" id="id_usuario" name="id_usuario" value="1h0p">
<input type="hidden" id="numeros_bilhetes" name="numeros_bilhetes" value="031,047,048">
<input type="hidden" id="valor_bilhete" name="valor_bilhete" value="154">
<span class="v_total">77</span>
<button type="submit" class="finalizar-btn">Participar</button>
</form>
I have read the following with the data
<li><a class='ativado btn_compra_rifa' data-valor='$valor_rifa' href='JavaScript:void(0);'><i>$i</i></a></li>
My jquery
$('.btn_compra_rifa').click(function() {
if ($(this).hasClass('desativado')) {
$(this).removeClass('desativado').addClass('selecionado');
var valor_rifa = parseFloat($(this).attr("data-valor"));
var resultado = $(".v_total").html()
$('input[name=valor_bilhete]').val(valor_rifa);
var bilhete_soma = $('#valor_bilhete').val() + valor_rifa;
$('input[name=valor_bilhete]').val(valor_rifa);
alert(bilhete_soma);
It doesn’t add up the values, and when it adds up it doubles at once.. what I’m doing wrong?
It had to add 77+77= 154
The logic is that one can choose several numbers, The values add up
thank you worked
– Vinícius Remonti