2021-07-30

Input value changes after clicking in another div with Jquery mask and vue

I'm trying to use the jquery mask and vue plugin, my code:

HTML:

<div class="mb-2">
    <label class="form-label">Salary</label>
        <input v-model="newEmployeeSalary" class="form-control moneyMask" id="employeeSalary" required>
</div>

JS:

$(document).ready(function($){
    $('.money').mask('000.000.000.000.000,00', {reverse: true});
});

The problem is that the inputed value changes after clicking in another div. Example :

Here I'm adding a money value, and the mask works perfectly:

The value is 2.000,0

Then, here I just clicked on the next input of the form and the Salary input mask breaks:

Values chagnes

My vue code:

data() {
    return {
      newContractTotalValue: '',
    }
},

I noticed that if I remove the v-model the error dissapers, but I need to use it. Can someone help me with that ?, I really have no idea what to do



from Recent Questions - Stack Overflow https://ift.tt/3BSEjce
https://ift.tt/2V60Cut

No comments:

Post a Comment