Javascript input mask
Quick reference
The mask tokens should be defined in lower case and can be used in combination with each other to compose and force different input formats.
Basic example
<html>
<script src="https://jsuites.net/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />
<input data-mask='U$ #.##0,00'>
</html>
Input mask options
Method | Description |
---|---|
a | Any letter |
0 | Number |
0 liters | Number |
0% | Percentage |
#,##0 | Currency |
$ #,##0.00 | Currency with decimal |
$ #.##0,00 | Currency with decimal |
dd/mm/yyyy | Date |
hh:mm | Time |
yyyy | Year four digits |
yy | Year two digits |
mm | Month |
dd | Day |
hh24 | Hour 24 |
hh | Hour 12 |
mi | Minutes |
ss | Seconds |
\a | Letter "a" (escape for a) |
\0 | Number "0" (escape for 0) |
[-] | Number signal (- or +) |
Advance masking combination
A few valid tokens can be used with mask as below:
0
0.00
0%
0.00%
#,##0
#,##0.00
#,##0;(#,##0)
#,##0;Red
#,##0.00;(#,##0.00)
#,##0.00;Red
d-mmm-yy
d-mmm
dd/mm/yyyy
mmm-yy
h:mm AM/PM
h:mm:ss AM/PM
h:mm
h:mm:ss
m/d/yy h:mm
mm:ss
[h]:mm:ss