In my project I use Bootstrap 4 and jQuery / JavaScript.
I have this code:
$(document).ready(function () {
$('.currencyMask').mask("###0.00", {reverse: true});
$('.numbersMask').mask("#", {reverse: true});
});
function getDynamicInput(productType) {
$(".dynamic-content-input").load("{{ route('product.product.feature') }}/" +
productType +
"/@if (!empty($product)){{ $product->id }} @else{{0}} @endif",
function (response, status, xhr) {
});
}
This code in result dynamic input:
<div class="dynamic-content-input">
<div class="form-group row">
<label class="col-form-label text-right col-lg-3 col-sm-12">Pole liczbowe</label>
<div class="col-lg-9 col-md-9 col-sm-12">
<input type="text" name="form-2" class="form-control numbersMask " value="">
</div>
</div>
<div class="form-group row">
<label class="col-form-label text-right col-lg-3 col-sm-12">Pole tekstowe</label>
<div class="col-lg-9 col-md-9 col-sm-12">
<input type="text" name="form-3" class="form-control " value="">
</div>
</div>
</div>
This work fine. Problem is with the JavaScript function numbersMask.
When I add input in HTML - it's working fine (the function allows you to enter only numbers).
However, for input dynamically added, it does not work at all.
How can I repair it?