I need something like .mask("(999) 999-9999") I found this link https://github.com/RobinHerbots/Inputmask , I did not succeed
$(document).ready(function(){ $("#example1").inputmask("99-9999999"); $("#example2").inputmask("Regex"); }); <html> <head> <script src="jquery.js"></script> <script src="jquery.inputmask.bundle.js"></script> </head> <body> <input id="example1" data-inputmask-clearmaskonlostfocus="false" /> <input id="example2" data-inputmask-regex="[a-za-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?" /> </body> </html> This field (it is not editable!) Displays the word Regex .
I try another in fields we specify the regular expression.
$(document).ready(function(){ $("#example1").inputmask("aa-9{4}"); //static mask with dynamic syntax отображается __-_{4} $("#example2").inputmask("aa-9{1,4}"); //dynamic mask ~ the 9 def can be occur 1 to 4 times - отображается __-_{1,4} , {} -не работают //email mask отображается регулярное выражение, указанное в mask $("#example3").inputmask({ mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]", greedy: false, onBeforePaste: function (pastedValue, opts) { pastedValue = pastedValue.toLowerCase(); return pastedValue.replace("mailto:", ""); }, definitions: { '*': { validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]", cardinality: 1, casing: "lower" } } }); }); <html> <head> <script src="jquery.js"></script> <script src="jquery.inputmask.bundle.js"></script> </head> <body> <input id="example1" /> <input id="example2" /> <input id="example3" /> </body> </html>