1
I have the following function:
function alteraSaldo(item){
saldo = parseInt($('#saldo').val());
campo = $('#'+item);
if (campo.checked == true){
alert('sim');
saldo = saldo - parseInt(campo.data("valor"));
}else{
alert('nao');
saldo = saldo + parseInt(campo.data("valor"));
}
$('#saldo').val(saldo);
}
I call her at the checkbox onclick event:
<input type="checkbox" data-valor="28.00" id="mensalidade9" onclick="alteraSaldo('mensalidade9');" />
The function recognizes the checkbox as it shows the correct value, but always shows that it is NOT "checked".
What can it be?