| Reference |
Details |
Inputmask
|
Inputmask is a javascript library that creates an
input mask. Inputmask can run against vanilla
javascript, jQuery, and jqlite. An inputmask
helps the user with the input by ensuring a predefined
format. This can be useful for dates, numerics, phone
numbers, ...
|
Initialization
|
-
Inputmask instances can be initialized via
new Inputmask() class as explained in
the
Documentation.
-
Inputmask instances can be initialized via
data-inputmask HTML attribute as
explained in the
Documentation.
|
$("#inputmaskDate").inputmask({
alias: "datetime",
inputFormat: "mm/dd/yyyy",
});
$("#inputmaskPlaceholder").inputmask({
mask: "(999) 999-9999",
placeholder: "(xxx) xxx-xxxx",
});
$("#inputmaskPhone").inputmask("(999) 999-9999");
$("#inputmaskCard").inputmask("9999 9999 9999 9999");
$("#inputmaskIP").inputmask("999.999.999.999");
$("#inputmaskSSN").inputmask("999-99-9999");
$("#inputmaskISBN").inputmask("999-99-999-9999-9");
$("#inputmaskCurrency").inputmask("$999.999,99");
$("#inputmaskPurchase").inputmask("AAAA 9999-****");
$("#inputmaskOptional").inputmask("(99) 9999[9]-9999");
$("#inputmaskNumLetter").inputmask("999-AAA");
$("#inputmaskDecimal").inputmask({
alias: "decimal",
radixPoint: ".",
});
$("#inputmaskEmail").inputmask({
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[*{2,6}][*{1,2}].*{1,}[.*{2,6}][.*{1,2}]",
greedy: !1,
onBeforePaste: function (n, a) {
return (e = e.toLowerCase()).replace("mailto:", "");
},
definitions: {
"*": {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~/-]",
cardinality: 1,
casing: "lower",
},
},
});
$("#inputmaskRTL").inputmask("99/999/9999");