1
I have a problem here that I can not solve , in this script below performs a calculation of on the marked seats, so far everything is perfect the problem and when I put a Ubmit button to send the data and ends up zeroing the result field giving Nan error. how can I fix this?
 follow the javascript  https://jsfiddle.net/fabioo7/wjsdxLvk/
follow the javascript  https://jsfiddle.net/fabioo7/wjsdxLvk/
$(window).load(function(){
var contador = function() {
var n = $("input:enabled:checked").length;
var unchecked = 0;
var cb = $(this).index();
$("input:enabled").each(function(i) {
if ((i < cb) && !($(this).is(":checked"))) {
++unchecked;
}
}) 
if($(this).is(":checked")){
$('#campo').append('<div style="margin-top: 10px;"><input type="text"     placeholder="Insira seu Ticket" name="tks[]" required  class="created"    name="check1" ></div>');
}else{
$('.created').eq($(this).index()-unchecked).remove();
} 
$("#checkcount").text(n + (n === 1 ) + " Cadeiras Marcadas");
};
contador();
$("input[type=checkbox]").on("click", contador);
(function() {
var elements = document.getElementsByTagName('input');
var resultado = document.getElementById('resultado_soma');
var resultadoInput = document.getElementById('resultado_soma2');
var checkCount = document.getElementById('checkcount2');
var total = 0;
for (var i = 0; i < elements.length; i++) {
    elements[i].onclick = function() {
        if (this.checked === false) {
            total = total - this.value;
        } else {
            total = total + parseFloat(this.value);
        }
        resultado.innerHTML  = 'R$ ' + total.toFixed(2).replace(".",",");
        resultadoInput.value  = total.toFixed(2).replace(".",",");
        checkCount.value =  $("input:enabled:checked").length;
    }
}
})();
});
What exactly do you want to do with this function "Pay"?
– Samir Braga
Tranquil Samir.... And that at the time I will save will not go anything in the post because of the Nan Error just by clicking on the Ubmit input
– Fabio Henrique