class: float
With this example, AutoNumeric applied only to the first element input with class the float.
<script src = "https://unpkg.com/autonumeric" ></script>
<form>
<input type="text" class="form-control cell-in-text float" id="26" asp-for="@Model.ListEtpAnswer.ElementAt(26).Answer" />
<br />
<input type="text" class="form-control cell-in-text float" id="27" asp-for="@Model.ListEtpAnswer.ElementAt(27).Answer" />
<br />
<input type="text" class="form-control cell-in-text float" id="28" asp-for="@Model.ListEtpAnswer.ElementAt(28).Answer" />
<br />
<script>
const autoNumericOptions = {
allowDecimalPadding: "floats",
decimalCharacter: ",",
digitGroupSeparator: "",
//emptyInputBehavior: "zero",
watchExternalChanges: true
};
new AutoNumeric(".float", autoNumericOptions);
</script>
You need to use Autonumeric.multiple to apply it to multiple elements at once.
<script src = "https://unpkg.com/autonumeric" ></script>
<form>
<input type="text" class="form-control cell-in-text float" id="26" asp-for="@Model.ListEtpAnswer.ElementAt(26).Answer" />
<br />
<input type="text" class="form-control cell-in-text float" id="27" asp-for="@Model.ListEtpAnswer.ElementAt(27).Answer" />
<br />
<input type="text" class="form-control cell-in-text float" id="28" asp-for="@Model.ListEtpAnswer.ElementAt(28).Answer" />
<br />
<script>
const autoNumericOptions = {
allowDecimalPadding: "floats",
decimalCharacter: ",",
digitGroupSeparator: "",
//emptyInputBehavior: "zero",
watchExternalChanges: true
};
AutoNumeric.multiple(".float",null, autoNumericOptions);
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With