I'm trying to put a value inside a input that is masked both in typing and in the value entered.
Well, I have a list of real estate listings in the database where I pull the front, okay?
And not going into many specifications, whenever I enter a value in INPUT (Ex: 100.000,00
) it comes quietly formatted, however when I click "Save" (from my system, irrelevant now) the value of input changes to 100.00
. Here is the code for the front:
<div class="col-md-4">
<div class="form-group">
<label class="bold label-color-cinza">Preço</label>
<input type="text" maxlength="" class="form-control input-sm moeda" name="valor" value="<?= $imovel->valor ?>" placeholder="Preço">
</div>
Please, I'm trying everything and it always comes to that. Below the mask code:
$('.moeda').mask('999.999.999,99');
You are inside a ready calm, here is quiet.
Again, my problem is:
- I can not set the input value to the value written to the input.
Thanks to all who can help !!!
EDIT 1: After some suggestions from you the problem persisted. The typing mask is fine. I always test using the 100,000.00 value and the printed result gets 100.00.
100,000.00 = > 100,00
10,000.00 = > 10,00
1,000,000.00 = > 1.00
You have seen that he is always picking up the digits before the 1st point and adding the ", 00" [End EDIT 1]