Verification return is sent three times

-1

By clicking the button, run this code down

It was to generate only one position of the array. In the case it is generated 3 positions, as if it had happened 3 tests

$(document).on('click','#btnSegundaEtapa',function () {

    var arrayObjCat1 = [];

    $(".form-group").find('*').each(function(){
        var id = $(this).attr("id");

        if($(this).is(':checked')){
            if ( $("input[type='radio'][name='Licenciamentodeusuários']").is(':checked') ) {
                className = $("#"+id).data('class-name');
                vlrUnitario = $("."+className).text();

                vlrUnitario = vlrUnitario.replace("$","");
                vlrUnitario = parseFloat(vlrUnitario.replace(',','.'));
                arrayObjCat1.push({part_number:$('#'+id).data('part-number'), nome_item:$('#'+id).data('nome-item'),qtde:$('#'+id).val(),preco_unitario:vlrUnitario});
                console.log(arrayObjCat1);
            }


         }
     })

});

And this return happens

    
asked by anonymous 29.08.2017 / 20:02

1 answer

0
$(document).on('click','#btnSegundaEtapa',function () {

    var arrayObjCat1 = [];

    $(".form-group").find('*').each(function(){
        var id = $(this).attr("id");

        if($(this).is(':checked')){
            if ( $("input[type='radio'][name='"+id+"']").is(':checked') ) {
                className = $("#"+id).data('class-name');
                vlrUnitario = $("."+className).text();

                vlrUnitario = vlrUnitario.replace("$","");
                vlrUnitario = parseFloat(vlrUnitario.replace(',','.'));
                arrayObjCat1.push({part_number:$('#'+id).data('part-number'), nome_item:$('#'+id).data('nome-item'),qtde:$('#'+id).val(),preco_unitario:vlrUnitario});
                console.log(arrayObjCat1);
            }


         }
     })

});

The above code solved my problem

    
29.08.2017 / 21:04