1
I’m using the jQuery Mask to format currency in a form, and in this form it is possible to add several values dynamically and for this I duplicate the div that contains the input, only when duplicating this div jQuery Mask stops working in this new input created, how can I solve this?
Structure:
<div id="payment_draft">
<div class="form-group col-xl-6">
<label for="paid_value">Valor Pago</label>
<input type="text" class="form-control money_format" name="paid_value">
</div>
</div>
<button class="btn_add_payment">Duplicar</button>
<script type="text/javascript">
$('.money_format').mask('#.##0,00', {reverse: true});
$(document).on('click', '.btn_add_payment', function(){
var payment = $('#payment_draft');
var container = $('.payments_container'); //adiciona em outra div
var copy = payment.clone();
container.append(copy)
});
</script>
It worked perfectly! The "payment_draft" I put only here of example same, but it is not so there no, thanks!
– Thiago