Return Value with MoneyMask

1

I have a function that performs a calculation and changes the value of my component. But I would like it to return the value in Reals already with the Mask, I am using MaskMoney but it is returning NaN . Can anyone help me?

Follow the function:

function retornaResultado(num) {

    // Recupera valores
    var iuc = document.querySelector("#iuc");
    var gi = document.querySelector("#gi");
    var isb = document.querySelector("#isb");
    var cap = document.querySelector("#cap");
    var ca = document.querySelector("#ca");
  
    /*Tentando adicionar a máscara no campo*/
    $(document).ready(function() {
        $("#ca").maskMoney({
            showSymbol: true,
            symbol: "R$",
            decimal: ",",
            thousands: "."
        });
    });

    //Realiza Cálculo
    var risb = calculoISB();
    var rcap = calculoCAP();
    var calcgi = parseFloat(risb) + parseFloat(rcap) + parseFloat(iuc.value);
    
    gi.textContent = calcgi.toFixed(3);
    isb.textContent = calculoISB();
    cap.textContent = calculoCAP();
    var result = calcgi * num;
    
    /* Aqui fica o campo no qual quero alterar o valor já com a mask(R$)*/
    ca.textContent = result.toFixed(2);

}
    
asked by anonymous 15.06.2017 / 18:23

0 answers