Return Value with Moneymask

Asked

Viewed 65 times

1

I have a function that performs a calculation and changes the value of my component. But I would like her to return the real value already with the Mask, I’m using the MaskMoney but you’re returning NaN. Can someone help me?

Follows 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);

}

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.