Tambahkan masking input persentase menggunakan IMask
- Menambahkan konfigurasi masker input angka untuk elemen dengan class "persen". - Masker mendukung input angka dengan batas 0-100, pemisah ribuan ".", dan delimiter desimal ",". - Memastikan angka diformat dengan benar untuk meningkatkan pengalaman pengguna.
This commit is contained in:
parent
ded24338af
commit
2d46fa5065
@ -94,3 +94,20 @@ document.querySelectorAll(".currency").forEach((el) => {
|
|||||||
autofix: true,
|
autofix: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll(".persen").forEach((el) => {
|
||||||
|
IMask(el, {
|
||||||
|
mask: Number, // enable number mask
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
// other options are optional with defaults below
|
||||||
|
scale: 2, // digits after point, 0 for integers
|
||||||
|
thousandsSeparator: ".", // any single char
|
||||||
|
padFractionalZeros: false, // if true, then pads zeros at end to the length of scale
|
||||||
|
normalizeZeros: true, // appends or removes zeros at ends
|
||||||
|
radix: ",", // fractional delimiter
|
||||||
|
mapToRadix: ["."], // symbols to process as radix
|
||||||
|
|
||||||
|
autofix: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user