use-mask-input 3.0.5 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.cjs +177 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +34 -3
  4. package/dist/index.js +172 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +43 -51
  7. package/src/index.tsx +3 -2
  8. package/src/types.ts +6 -0
  9. package/src/useMaskInput.ts +12 -9
  10. package/src/utils.spec.ts +13 -0
  11. package/src/utils.ts +27 -0
  12. package/src/withHookFormMask.ts +9 -16
  13. package/src/withMask.ts +5 -6
  14. package/dist/example/App.example.d.ts +0 -3
  15. package/dist/example/index.d.ts +0 -1
  16. package/dist/index.modern.js +0 -2
  17. package/dist/index.modern.js.map +0 -1
  18. package/dist/index.module.js +0 -2
  19. package/dist/index.module.js.map +0 -1
  20. package/dist/index.umd.js +0 -2
  21. package/dist/index.umd.js.map +0 -1
  22. package/dist/useMaskInput.d.ts +0 -9
  23. package/dist/withHookFormMask.d.ts +0 -16
  24. package/dist/withMask.d.ts +0 -3
  25. package/node_modules/inputmask/LICENSE.txt +0 -7
  26. package/node_modules/inputmask/README.md +0 -1279
  27. package/node_modules/inputmask/bundle.js +0 -6
  28. package/node_modules/inputmask/dist/bindings/inputmask.binding.js +0 -26
  29. package/node_modules/inputmask/dist/inputmask.es6.js +0 -5
  30. package/node_modules/inputmask/dist/inputmask.js +0 -3031
  31. package/node_modules/inputmask/dist/inputmask.min.js +0 -8
  32. package/node_modules/inputmask/dist/jquery.inputmask.js +0 -2985
  33. package/node_modules/inputmask/dist/jquery.inputmask.min.js +0 -8
  34. package/node_modules/inputmask/lib/bindings/inputmask.binding.js +0 -26
  35. package/node_modules/inputmask/lib/bindings/inputmask.es6.js +0 -5
  36. package/node_modules/inputmask/lib/canUseDOM.js +0 -7
  37. package/node_modules/inputmask/lib/defaults.js +0 -101
  38. package/node_modules/inputmask/lib/definitions.js +0 -13
  39. package/node_modules/inputmask/lib/dependencyLibs/data.js +0 -8
  40. package/node_modules/inputmask/lib/dependencyLibs/events.js +0 -199
  41. package/node_modules/inputmask/lib/dependencyLibs/extend.js +0 -58
  42. package/node_modules/inputmask/lib/dependencyLibs/inputmask.dependencyLib.jquery.js +0 -13
  43. package/node_modules/inputmask/lib/dependencyLibs/inputmask.dependencyLib.js +0 -41
  44. package/node_modules/inputmask/lib/environment.js +0 -9
  45. package/node_modules/inputmask/lib/escapeRegex.js +0 -4
  46. package/node_modules/inputmask/lib/eventhandlers.js +0 -513
  47. package/node_modules/inputmask/lib/eventruler.js +0 -124
  48. package/node_modules/inputmask/lib/extensions/inputmask.date.extensions.js +0 -588
  49. package/node_modules/inputmask/lib/extensions/inputmask.extensions.js +0 -133
  50. package/node_modules/inputmask/lib/extensions/inputmask.numeric.extensions.js +0 -631
  51. package/node_modules/inputmask/lib/global/window.js +0 -3
  52. package/node_modules/inputmask/lib/inputHandling.js +0 -252
  53. package/node_modules/inputmask/lib/inputmask.js +0 -355
  54. package/node_modules/inputmask/lib/inputmaskElement.js +0 -33
  55. package/node_modules/inputmask/lib/jquery.inputmask.js +0 -81
  56. package/node_modules/inputmask/lib/keycode.json +0 -25
  57. package/node_modules/inputmask/lib/mask-lexer.js +0 -467
  58. package/node_modules/inputmask/lib/mask.js +0 -244
  59. package/node_modules/inputmask/lib/masktoken.js +0 -13
  60. package/node_modules/inputmask/lib/polyfills/Array.includes.js +0 -48
  61. package/node_modules/inputmask/lib/polyfills/Object.getPrototypeOf.js +0 -7
  62. package/node_modules/inputmask/lib/positioning.js +0 -348
  63. package/node_modules/inputmask/lib/validation-tests.js +0 -597
  64. package/node_modules/inputmask/lib/validation.js +0 -664
  65. package/node_modules/inputmask/package.json +0 -60
  66. package/src/example/App.example.tsx +0 -68
  67. package/src/example/index.tsx +0 -5
@@ -1,1279 +0,0 @@
1
- # Inputmask
2
-
3
- Copyright (c) 2010 - 2021 Robin Herbots Licensed under the MIT license (<https://opensource.org/licenses/MIT>)
4
-
5
- The Inputmask has a very permissive license and this will stay that way. But when you use the Inputmask in a commercial setting, be so honest to make a small donation.
6
- This will be appreciated very much.
7
-
8
- [![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZNR3EB6JTMMSS)
9
-
10
- ![npm](https://img.shields.io/npm/v/inputmask) ![npm (tag)](https://img.shields.io/npm/v/inputmask/next) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/inputmask)
11
-
12
- Inputmask is a javascript library that creates an input mask. Inputmask can run against vanilla javascript, jQuery, and jqlite.
13
-
14
- An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers, ...
15
-
16
- Highlights:
17
- - easy to use
18
- - optional parts anywhere in the mask
19
- - possibility to define aliases which hide the complexity
20
- - date / DateTime masks
21
- - numeric masks
22
- - lots of callbacks
23
- - non-greedy masks
24
- - many features can be enabled/disabled/configured by options
25
- - supports read-only/disabled/dir="rtl" attributes
26
- - support data-inputmask attribute(s)
27
- - alternator-mask
28
- - regex-mask
29
- - dynamic-mask
30
- - preprocessing-mask
31
- - JIT-masking
32
- - value formatting / validating without input element
33
- - AMD/CommonJS support
34
- - dependencyLibs: vanilla javascript, jQuery, jqlite
35
- - \<input-mask\> htmlelement
36
-
37
- Demo page see <https://robinherbots.github.io/Inputmask/>
38
-
39
- Thanks to [Jetbrains](https://www.jetbrains.com/?from=inputmask) for providing a free license for their excellent Webstorm IDE.
40
- <a href="https://www.jetbrains.com/?from=inputmask">
41
- <img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/JetBrains_Logo_2016.svg" alt="Jetbrains">
42
- </a>
43
-
44
- Thanks to [Browserstack](https://www.browserstack.com) for providing a free license, so we can start automating test in different browsers and devices.
45
- <a href="https://www.browserstack.com">
46
- <img src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png" alt="Browserstack" width="150">
47
- </a>
48
-
49
-
50
- ## Setup
51
- ### dependencyLibs
52
- Inputmask can run against different javascript libraries.
53
- You can choose between:
54
- - inputmask.dependencyLib (vanilla)
55
- - inputmask.dependencyLib.jquery
56
-
57
- ### Classic web with <script\> tag
58
- Include the js-files which you can find in the `dist` folder.
59
-
60
- Inputmask with jQuery as dependencylib.
61
- ```html
62
- <script src="jquery.js"></script>
63
- <script src="dist/jquery.inputmask.js"></script>
64
- ```
65
-
66
- Inputmask with vanilla dependencylib.
67
- ```html
68
- <script src="dist/inputmask.js"></script>
69
- ```
70
-
71
- If you like to automatically bind the inputmask to the inputs marked with the data-inputmask- ... attributes you may also want to include the inputmask.binding.js
72
-
73
- ```html
74
- <script src="dist/bindings/inputmask.binding.js"></script>
75
- ```
76
-
77
- ### webpack
78
-
79
- #### Install the package
80
- ```
81
- npm install inputmask --save
82
- ```
83
-
84
- ##### Install the latest beta version
85
- ```
86
- npm install inputmask@next --save
87
- ```
88
-
89
- #### In your modules
90
- If you want to include the Inputmask and all extensions.
91
- ```
92
- var Inputmask = require('inputmask');
93
-
94
- //es6
95
- import Inputmask from "inputmask";
96
- ```
97
-
98
- ### ES6
99
- ```
100
- import Inputmask from "inputmask.es6.js";
101
- ```
102
-
103
- ## Usage
104
- ### via Inputmask class
105
-
106
- ```javascript
107
- var selector = document.getElementById("selector");
108
-
109
- var im = new Inputmask("99-9999999");
110
- im.mask(selector);
111
-
112
- //or
113
-
114
- Inputmask({"mask": "(999) 999-9999", ... other_options, ...}).mask(selector);
115
- Inputmask("9-a{1,3}9{1,3}").mask(selector);
116
- Inputmask("9", { repeat: 10 }).mask(selector);
117
-
118
- Inputmask({ regex: "\\d*" }).mask(selector);
119
- Inputmask({ regex: String.raw`\d*` }).mask(selector);
120
- ```
121
-
122
- ### via jquery plugin
123
-
124
- ```javascript
125
- $(document).ready(function(){
126
- $(selector).inputmask("99-9999999"); //static mask
127
- $(selector).inputmask({"mask": "(999) 999-9999"}); //specifying options
128
- $(selector).inputmask("9-a{1,3}9{1,3}"); //mask with dynamic syntax
129
- });
130
- ```
131
-
132
- ### via data-inputmask attribute
133
-
134
- ```html
135
- <input data-inputmask="'alias': 'datetime'" />
136
- <input data-inputmask="'mask': '9', 'repeat': 10, 'greedy' : false" />
137
- <input data-inputmask="'mask': '99-9999999'" />
138
- ```
139
-
140
- ```javascript
141
- $(document).ready(function(){
142
- $(":input").inputmask();
143
- or
144
- Inputmask().mask(document.querySelectorAll("input"));
145
- });
146
- ```
147
-
148
- #### Any option can also be passed through the use of a data attribute. Use data-inputmask-<**_the name of the option_**>="value"
149
-
150
- ```html
151
- <input id="example1" data-inputmask-clearmaskonlostfocus="false" />
152
- <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])?" />
153
- ```
154
-
155
- ```javascript
156
- $(document).ready(function(){
157
- $("#example1").inputmask("99-9999999");
158
- $("#example2").inputmask();
159
- });
160
- ```
161
-
162
- ### via \<input-mask\> element
163
- Use the input-mask element in your HTML code and set the options as attributes.
164
-
165
- ```html
166
- <input-mask alias="currency"></input-mask>
167
- ```
168
-
169
-
170
- ### Allowed HTML-elements
171
- - `<input type="text">`
172
- - `<input type="search">`
173
- - `<input type="tel">`
174
- - `<input type="url">`
175
- - `<input type="password">`
176
- - `<div contenteditable="true">` (and all others supported by contenteditable)
177
- - `<textarea>`
178
- - any html-element (mask text content or set maskedvalue with jQuery.val)
179
-
180
- The allowed input types are defined in the supportsInputType option. Also see ([input-type-ref])
181
-
182
- ### Default masking definitions
183
- - `9` : numeric
184
- - `a` : alphabetical
185
- - `*` : alphanumeric
186
-
187
- There are more definitions defined within the extensions.<br>You can find info within the js-files or by further exploring the options.
188
-
189
- ###### Note:
190
- When your new mask is acting strange and replaces some static chars with the mask, then there is a definition that uses the char as a symbol.
191
- To solve this you need to [double escape the char](#escape-special-mask-chars).
192
-
193
-
194
- ## Masking types
195
- ### Static masks
196
- These are the very basics of masking. The mask is defined and will not change during the input.
197
-
198
- ```javascript
199
- $(document).ready(function(){
200
- $(selector).inputmask("aa-9999"); //static mask
201
- $(selector).inputmask({mask: "aa-9999"}); //static mask
202
- });
203
- ```
204
-
205
- ### Optional masks
206
- It is possible to define some parts in the mask as optional. This is done by using [ ].
207
-
208
- Example:
209
-
210
- ```javascript
211
- $('#test').inputmask('(99) 9999[9]-9999');
212
- ```
213
-
214
- This mask will allow input like `(99) 99999-9999` or `(99) 9999-9999`.
215
-
216
- Input => 12123451234 mask => (12) 12345-1234 (trigger complete)<br>
217
- Input => 121234-1234 mask => (12) 1234-1234 (trigger complete)<br>
218
- Input => 1212341234 mask => (12) 12341-234_ (trigger incomplete)
219
-
220
- #### skipOptionalPartCharacter
221
- As an extra, there is another configurable character which is used to skip an optional part in the mask.
222
-
223
- ```javascript
224
- skipOptionalPartCharacter: " "
225
- ```
226
-
227
- Input => 121234 1234 mask => (12) 1234-1234 (trigger complete)
228
-
229
- When `clearMaskOnLostFocus: true` is set in the options (default), the mask will clear out the optional part when it is not filled in, and this only in case the optional part is at the end of the mask.
230
-
231
- For example, given:
232
-
233
- ```javascript
234
- $('#test').inputmask('999[-AAA]');
235
- ```
236
-
237
- While the field has focus and is blank, users will see the full mask `___-___`. When the required part of the mask is filled and the field loses focus, the user will see `123`. When both the required and optional parts of the mask are filled out and the field loses focus, the user will see `123-ABC`.
238
-
239
- #### Optional masks with greedy false
240
- When defining an optional mask together with the greedy: false option, the inputmask will show the smallest possible mask as input first.
241
-
242
- ```javascript
243
- $(selector).inputmask({ mask: "9[-9999]", greedy: false });
244
- ```
245
-
246
- The initial mask shown will be "**_**" instead of "**_**-____".
247
-
248
- ### Dynamic masks
249
- Dynamic masks can change during input. To define a dynamic part use { }.
250
-
251
- {n} => n repeats
252
- {n|j} => n repeats, with j jitmasking
253
- {n,m} => from n to m repeats
254
- {n,m|j} => from n to m repeats, with j jitmasking
255
-
256
- Also {+} and {*} is allowed. + start from 1 and * start from 0.
257
-
258
- ```javascript
259
- $(document).ready(function(){
260
- $(selector).inputmask("aa-9{4}"); //static mask with dynamic syntax
261
- $(selector).inputmask("aa-9{1,4}"); //dynamic mask ~ the 9 def can be occur 1 to 4 times
262
-
263
- //email mask
264
- $(selector).inputmask({
265
- mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
266
- greedy: false,
267
- onBeforePaste: function (pastedValue, opts) {
268
- pastedValue = pastedValue.toLowerCase();
269
- return pastedValue.replace("mailto:", "");
270
- },
271
- definitions: {
272
- '*': {
273
- validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
274
- casing: "lower"
275
- }
276
- }
277
- });
278
- //decimal mask
279
- Inputmask("(.999){+|1},00", {
280
- positionCaretOnClick: "radixFocus",
281
- radixPoint: ",",
282
- _radixDance: true,
283
- numericInput: true,
284
- placeholder: "0",
285
- definitions: {
286
- "0": {
287
- validator: "[0-9\uFF11-\uFF19]"
288
- }
289
- }
290
- }).mask(selector);
291
- });
292
- ```
293
-
294
- ### Alternator masks
295
- The alternator syntax is like an **OR** statement. The mask can be one of the 3 choices specified in the alternator.
296
-
297
- To define an alternator use the |.
298
- ex: "a|9" => a or 9
299
- "(aaa)|(999)" => aaa or 999
300
- "(aaa|999|9AA)" => aaa or 999 or 9AA
301
- "aaaa|9999" => aaa a or 9 999
302
-
303
- **Also make sure to read about the [keepStatic](#keepStatic) option.**
304
-
305
- ```javascript
306
- $("selector").inputmask("(99.9)|(X)", {
307
- definitions: {
308
- "X": {
309
- validator: "[xX]",
310
- casing: "upper"
311
- }
312
- }
313
- });
314
- ```
315
-
316
- or
317
-
318
- ```javascript
319
- $("selector").inputmask({
320
- mask: ["99.9", "X"],
321
- definitions: {
322
- "X": {
323
- validator: "[xX]",
324
- casing: "upper"
325
- }
326
- }
327
- });
328
- ```
329
-
330
- ### Preprocessing masks
331
- You can define the mask as a function that can allow you to preprocess the resulting mask. Example sorting for multiple masks or retrieving mask definitions dynamically through ajax. The preprocessing fn should return a valid mask definition.
332
-
333
- ```javascript
334
- $(selector).inputmask({ mask: function () { /* do stuff */ return ["[1-]AAA-999", "[1-]999-AAA"]; }});
335
- ```
336
-
337
- ### JIT Masking
338
- Just in time masking. With the jitMasking option, you can enable jit masking. The mask will only be visible for the user-entered characters.
339
- Default: false
340
-
341
- Value can be true or a threshold number or false.
342
-
343
- ```javascript
344
- Inputmask("datetime", { jitMasking: true }).mask(selector);
345
- ```
346
-
347
- ## Define custom definitions
348
- You can define your own definitions to use in your mask.<br>Start by choosing a masksymbol.
349
-
350
- ### validator(chrs, maskset, pos, strict, opts)
351
- Next, define your validator. The validator can be a regular expression or a function.
352
-
353
- The return value of a validator can be true, false, or a command object.
354
-
355
- #### Options of the command object
356
- - pos : position to insert
357
- - c : character to insert
358
- - caret : position of the caret
359
- - remove : position(s) to remove
360
- - pos or [pos1, pos2]
361
-
362
- - insert : position(s) to add :
363
- - { pos : position to insert, c : character to insert, fromIsValid : true/false, strict : true/false }
364
- - [{ pos : position to insert, c : character to insert, fromIsValid : true/false, strict : true/false }, { ...}, ... ]
365
-
366
- fromIsValid & strict defaults to true.
367
-
368
- - refreshFromBuffer :
369
- - true => refresh validPositions from the complete buffer
370
- - { start: , end: } => refresh from start to end
371
- - rewritePosition: rewrite the maskPos within the isvalid function
372
- See [preValidation option](#preValidation)
373
-
374
- ### definitionSymbol
375
- When you insert or delete characters, they are only shifted when the definition type is the same. This behavior can be overridden by giving a definitionSymbol. (see example x, y, z, which can be used for IP-address masking, the validation is different, but it is allowed to shift the characters between the definitions)
376
-
377
- ```javascript
378
- Inputmask.extendDefinitions({
379
- 'f': { //masksymbol
380
- "validator": "[0-9\(\)\.\+/ ]"
381
- },
382
- 'g': {
383
- "validator": function (chrs, buffer, pos, strict, opts) {
384
- //do some logic and return true, false, or { "pos": new position, "c": character to place }
385
- }
386
- },
387
- 'j': { //basic year
388
- validator: "(19|20)\\d{2}"
389
- },
390
- 'x': {
391
- validator: "[0-2]",
392
- definitionSymbol: "i" //this allows shifting values from other definitions, with the same masksymbol or definitionSymbol
393
- },
394
- 'y': {
395
- validator: function (chrs, buffer, pos, strict, opts) {
396
- var valExp2 = new RegExp("2[0-5]|[01][0-9]");
397
- return valExp2.test(buffer[pos - 1] + chrs);
398
- },
399
- definitionSymbol: "i"
400
- },
401
- 'z': {
402
- validator: function (chrs, buffer, pos, strict, opts) {
403
- var valExp3 = new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]");
404
- return valExp3.test(buffer[pos - 2] + buffer[pos - 1] + chrs);
405
- },
406
- definitionSymbol: "i"
407
- }
408
- });
409
- ```
410
-
411
- ### placeholder
412
- Specify a placeholder for a definition. This can also be a function.
413
-
414
- ### optional
415
- Mark the definition as optional
416
-
417
- ### static
418
- Mark the definition as static
419
-
420
- ### casing (definition option)
421
- Specify casing options.
422
- The options are the same as the [Casing option](#casing)
423
-
424
- ### generated
425
- Mark the definition as generated
426
-
427
- ## set defaults
428
- The defaults can be set as below.
429
-
430
- ```javascript
431
- Inputmask.extendDefaults({
432
- 'autoUnmask': true
433
- });
434
- Inputmask.extendDefinitions({
435
- 'A': {
436
- validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
437
- casing: "upper" //auto uppercasing
438
- },
439
- '+': {
440
- validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
441
- casing: "upper"
442
- }
443
- });
444
- Inputmask.extendAliases({
445
- 'numeric': {
446
- mask: "r",
447
- greedy: false,
448
- ...
449
- }
450
- });
451
- ```
452
-
453
- But if the property is defined within an alias you need to set it for the alias definition.
454
- This is also for default plugin options. If the alias definitions extend on default options, you can only override it at alias level.
455
-
456
- ```javascript
457
- Inputmask.extendAliases({
458
- 'numeric': {
459
- autoUnmask: true,
460
- allowPlus: false,
461
- allowMinus: false
462
- }
463
- });
464
- ```
465
-
466
- However, the preferred way to alter properties for an alias is by creating a new alias that inherits from the default alias definition.
467
-
468
- ```javascript
469
- Inputmask.extendAliases({
470
- 'myNum': {
471
- alias: "numeric",
472
- placeholder: '',
473
- allowPlus: false,
474
- allowMinus: false
475
- }
476
- });
477
- ```
478
-
479
- Once defined, you can call the alias by:
480
-
481
- ```javascript
482
- Inputmask("myNum").mask(selector);
483
- ```
484
-
485
- All callbacks are implemented as options. This means that you can set general implementations for the callbacks by setting a default.
486
-
487
- ```javascript
488
- Inputmask.extendDefaults({
489
- onKeyValidation: function(key, result){
490
- if (!result){
491
- alert('Your input is not valid')
492
- }
493
- }
494
- });
495
- ```
496
-
497
- ## Methods:
498
- ### mask(elems)
499
- Create a mask for the input.
500
-
501
- ```javascript
502
- $(selector).inputmask({ mask: "99-999-99"});
503
- ```
504
-
505
- or
506
-
507
- ```javascript
508
- Inputmask({ mask: "99-999-99"}).mask(document.querySelectorAll(selector));
509
- ```
510
-
511
- or
512
-
513
- ```javascript
514
- Inputmask("99-999-99").mask(document.querySelectorAll(selector));
515
- ```
516
-
517
- or
518
-
519
- ```javascript
520
- var im = new Inputmask("99-999-99");
521
- im.mask(document.querySelectorAll(selector));
522
- ```
523
-
524
- or
525
-
526
- ```javascript
527
- Inputmask("99-999-99").mask(selector);
528
- ```
529
-
530
- ### unmaskedvalue
531
- Get the `unmaskedvalue`
532
-
533
-
534
- ```javascript
535
- $(selector).inputmask('unmaskedvalue');
536
- ```
537
-
538
- or
539
-
540
- ```javascript
541
- var input = document.getElementById(selector);
542
- if (input.inputmask)
543
- input.inputmask.unmaskedvalue()
544
- ```
545
-
546
- #### Value unmasking
547
- Unmask a given value against the mask.
548
-
549
- ```javascript
550
- var unformattedMask = Inputmask.unmask("123-45678-90", { mask: "999-99999-99" }); //1234567890
551
- var unformattedDate = Inputmask.unmask("23/03/1973", { alias: "datetime", inputFormat: "dd/mm/yyyy", outputFormat: "ddmmyyyy"});//23031973
552
- ```
553
-
554
- ### remove
555
- Remove the `inputmask`.
556
-
557
- ```javascript
558
- $(selector).inputmask('remove');
559
- ```
560
-
561
- or
562
-
563
- ```javascript
564
- var input = document.getElementById(selector);
565
- if (input.inputmask)
566
- input.inputmask.remove()
567
- ```
568
-
569
- or
570
-
571
- ```javascript
572
- Inputmask.remove(document.getElementById(selector));
573
- ```
574
-
575
- ### getemptymask
576
- return the default (empty) mask value
577
-
578
- ```javascript
579
- $(document).ready(function(){
580
- $("#test").inputmask("999-AAA");
581
- var initialValue = $("#test").inputmask("getemptymask"); // initialValue => "___-___"
582
- });
583
- ```
584
-
585
- ### hasMaskedValue
586
- Check whether the returned value is masked or not; currently only works reliably when using jquery.val fn to retrieve the value
587
-
588
- ```javascript
589
- $(document).ready(function(){
590
- function validateMaskedValue(val){}
591
- function validateValue(val){}
592
-
593
- var val = $("#test").val();
594
- if ($("#test").inputmask("hasMaskedValue"))
595
- validateMaskedValue(val);
596
- else
597
- validateValue(val);
598
- });
599
- ```
600
-
601
- ### isComplete
602
- Verify whether the current value is complete or not.
603
-
604
- ```javascript
605
- $(document).ready(function(){
606
- if ($(selector).inputmask("isComplete")){
607
- //do something
608
- }
609
- });
610
- ```
611
-
612
- ### getmetadata
613
- The metadata of the actual mask provided in the mask definitions can be obtained by calling getmetadata. If only a mask is provided the mask definition will be returned by the getmetadata.
614
-
615
- ```javascript
616
- $(selector).inputmask("getmetadata");
617
- ```
618
-
619
- ### setvalue
620
- The setvalue functionality is to set a value to the inputmask like you would do with jQuery.val,
621
- BUT it will trigger the internal event used by the inputmask always, whatever the case.
622
- This is particular usefull when cloning an inputmask with jQuery.clone. Cloning an inputmask is not a fully functional clone.
623
- On the first event (mouseenter, focus, ...) the inputmask can detect if it were cloned and can reactivate the masking. However when setting the value with jQuery.val there is none of the events triggered in that case. The setvalue functionality does this for you.
624
-
625
- ```
626
- $(selector).inputmask("setvalue", value);
627
-
628
- var selector = document.getElementById("selector");
629
- selector.inputmask.setValue(value);
630
-
631
- Inputmask.setValue(selector, value);
632
- ```
633
-
634
-
635
- ### option(options, noremask)
636
- Get or set an option on an existing inputmask.
637
- The option method is intented for adding extra options like callbacks, etc at a later time to the mask.
638
-
639
- When extra options are set the mask is automatically reapplied, unless you pas true for the noremask argument.
640
-
641
- Set an option
642
- ```javascript
643
- document.querySelector("#CellPhone").inputmask.option({
644
- onBeforePaste: function (pastedValue, opts) {
645
- return phoneNumOnPaste(pastedValue, opts);
646
- }
647
- });
648
- ```
649
-
650
- ```javascript
651
- $("#CellPhone").inputmask("option", {
652
- onBeforePaste: function (pastedValue, opts) {
653
- return phoneNumOnPaste(pastedValue, opts);
654
- }
655
- })
656
- ```
657
-
658
- ### format
659
- Instead of masking an input element, it is also possible to use the inputmask for formatting given values. Think of formatting values to show in jqGrid or on other elements then inputs.
660
-
661
- ```javascript
662
- var formattedDate = Inputmask.format("2331973", { alias: "datetime", inputFormat: "dd/mm/yyyy"});
663
- ```
664
-
665
- ### isValid
666
- Validate a given value against the mask.
667
-
668
- ```javascript
669
- var isValid = Inputmask.isValid("23/03/1973", { alias: "datetime", inputFormat: "dd/mm/yyyy"});
670
- ```
671
-
672
- ## Options:
673
- ### placeholder
674
- Change the mask placeholder.
675
- Default: "_"
676
-
677
- Instead of "_", you can change the unfilled characters mask as you like, simply by adding the `placeholder` option.<br>
678
- For example, `placeholder: " "` will change the default autofill with empty values
679
-
680
- ```javascript
681
- $(document).ready(function(){
682
- $("#date").inputmask("99/99/9999",{ "placeholder": "*" });
683
- });
684
- ```
685
-
686
- or a multi-char placeholder
687
-
688
- ```javascript
689
- $(document).ready(function(){
690
- $("#date").inputmask("99/99/9999",{ "placeholder": "dd/mm/yyyy" });
691
- });
692
- ```
693
-
694
- ### optionalmarker
695
- Definition of the symbols used to indicate an optional part in the mask.
696
-
697
- ```javascript
698
- optionalmarker: { start: "[", end: "]" }
699
- ```
700
-
701
- ### quantifiermarker
702
- Definition of the symbols used to indicate a quantifier in the mask.
703
-
704
- ```javascript
705
- quantifiermarker: { start: "{", end: "}" }
706
- ```
707
-
708
- ### groupmarker
709
- Definition of the symbols used to indicate a group in the mask.
710
-
711
- ```javascript
712
- groupmarker: { start: "(", end: ")" }
713
- ```
714
-
715
- ### alternatormarker
716
- Definition of the symbols used to indicate an alternator part in the mask.
717
-
718
- ```javascript
719
- alternatormarker: "|"
720
- ```
721
-
722
- ### escapeChar
723
- Definition of the symbols used to escape a part in the mask.
724
-
725
- ```javascript
726
- escapeChar: "\\"
727
- ```
728
-
729
- See [escape special mask chars](#escape-special-mask-chars)
730
-
731
- ### mask
732
- The mask to use.
733
-
734
- ```
735
- Inputmask({ mask: "9{*}").mask(selector);
736
- ```
737
-
738
- ### regex
739
- Use a regular expression as a mask
740
-
741
- ```
742
- Inputmask({ regex: "[0-9]*" }).mask(selector);
743
- ```
744
-
745
- When using shorthands be aware that you need to double escape or use String.raw with a string literal.
746
- ```
747
- Inputmask({ regex: "\\d*" }).mask(selector);
748
- ~
749
- Inputmask({ regex: String.raw`\d*` }).mask(selector);
750
- ```
751
-
752
- ### oncomplete
753
- Execute a function when the mask is completed
754
-
755
- ```javascript
756
- $(document).ready(function(){
757
- $("#date").inputmask("99/99/9999",{ "oncomplete": function(){ alert('inputmask complete'); } });
758
- });
759
- ```
760
-
761
- ### onincomplete
762
- Execute a function when the mask is incomplete. Executes on blur.
763
-
764
- ```javascript
765
- $(document).ready(function(){
766
- $("#date").inputmask("99/99/9999",{ "onincomplete": function(){ alert('inputmask incomplete'); } });
767
- });
768
- ```
769
-
770
- ### oncleared
771
- Execute a function when the mask is cleared.
772
-
773
- ```javascript
774
- $(document).ready(function(){
775
- $("#date").inputmask("99/99/9999",{ "oncleared": function(){ alert('inputmask cleared'); } });
776
- });
777
- ```
778
-
779
- ### repeat
780
- Mask repeat function. Repeat the mask definition x-times.
781
-
782
- ```javascript
783
- $(document).ready(function(){
784
- $("#number").inputmask({ "mask": "9", "repeat": 10 }); // ~ mask "9999999999"
785
- });
786
- ```
787
-
788
- ### greedy
789
- Default: false
790
- Toggle to allocate as much possible or the opposite. Non-greedy repeat function.
791
-
792
- ```javascript
793
- $(document).ready(function(){
794
- $("#number").inputmask({ "mask": "9", "repeat": 10, "greedy": false }); // ~ mask "9" or mask "99" or ... mask "9999999999"
795
- });
796
- ```
797
-
798
- With the non-greedy option set to false, you can specify * as repeat. This makes an endless repeat.
799
-
800
- ### autoUnmask
801
- Automatically unmask the value when retrieved.<br>Default: false.
802
-
803
- **When setting this option to true the plugin also expects the initial value from the server to be unmasked.**
804
-
805
- ### removeMaskOnSubmit
806
- Remove the mask before submitting the form.<br>Default: false
807
-
808
- ### clearMaskOnLostFocus
809
- Remove the empty mask on blur or when not empty remove the optional trailing part Default: true
810
-
811
- ```javascript
812
- $(document).ready(function(){
813
- $("#ssn").inputmask("999-99-9999",{placeholder:" ", clearMaskOnLostFocus: true }); //default
814
- });
815
- ```
816
-
817
- ### insertMode
818
- Toggle to insert or overwrite input.<br>Default: true.<br>This option can be altered by pressing the Insert key.
819
-
820
- #### insertModeVisual
821
- Show selected caret when insertmode = false.
822
-
823
- ### clearIncomplete
824
- Clear the incomplete input on blur
825
-
826
- ```javascript
827
- $(document).ready(function(){
828
- $("#date").inputmask("99/99/9999",{ "clearIncomplete": true });
829
- });
830
- ```
831
-
832
- ### aliases
833
- Definitions of aliases.
834
-
835
- With an alias, you can define a complex mask definition and call it by using an alias name. So this is mainly to simplify the use of your masks. Some aliases found in the extensions are email, currency, decimal, integer, date, DateTime, dd/mm/yyyy, etc.
836
-
837
- First, you have to create an alias definition. The alias definition can contain options for the mask, custom definitions, the mask to use, etc.
838
-
839
- When you pass in an alias, the alias is first resolved and then the other options are applied. So you can call an alias and pass another mask to be applied over the alias. This also means that you can write aliases that "inherit" from another alias.
840
-
841
- Some examples can be found in jquery.inputmask.xxx.extensions.js
842
-
843
- use:
844
-
845
- ```javascript
846
- $("#date").inputmask("datetime");
847
- ```
848
-
849
- or
850
-
851
- ```javascript
852
- $("#date").inputmask({ alias: "datetime"});
853
- ```
854
-
855
- You can also call an alias and extend it with some more options
856
-
857
- ```javascript
858
- $("#date").inputmask("datetime", { "clearIncomplete": true });
859
- ```
860
-
861
- or
862
-
863
- ```javascript
864
- $("#date").inputmask({ alias: "datetime", "clearIncomplete": true });
865
- ```
866
-
867
- ### alias
868
- The alias to use.
869
-
870
- ```javascript
871
- $("#date").inputmask({ alias: "email"});
872
- ```
873
-
874
- ### onKeyDown
875
- Callback to implement autocomplete on certain keys for example
876
-
877
- Function arguments: event, buffer, caretPos, opts<br>Function return:
878
-
879
- ### onBeforeMask
880
- Executes before masking the initial value to allow preprocessing of the initial value.
881
-
882
- Function arguments: initialValue, opts<br>Function return: processedValue
883
-
884
- ```javascript
885
- $(selector).inputmask({
886
- alias: 'phonebe',
887
- onBeforeMask: function (value, opts) {
888
- var processedValue = value.replace(/^0/g, "");
889
- if (processedValue.indexOf("32") > 1 || processedValue.indexOf("32") == -1) {
890
- processedValue = "32" + processedValue;
891
- }
892
-
893
- return processedValue;
894
- }
895
- });
896
- ```
897
-
898
- ### onBeforePaste
899
- This callback allows for preprocessing the pasted value before actually handling the value for masking. This can be useful for stripping away some characters before processing.
900
-
901
- Function arguments: pastedValue, opts<br>Function return: processedValue
902
-
903
- ```javascript
904
- $(selector).inputmask({
905
- mask: '9999 9999 9999 9999',
906
- placeholder: ' ',
907
- showMaskOnHover: false,
908
- showMaskOnFocus: false,
909
- onBeforePaste: function (pastedValue, opts) {
910
- var processedValue = pastedValue;
911
-
912
- //do something with it
913
-
914
- return processedValue;
915
- }
916
- });
917
- ```
918
-
919
- You can also disable pasting a value by returning false in the onBeforePaste call.
920
-
921
- Default: Calls the onBeforeMask
922
-
923
- ### onBeforeWrite
924
- Executes before writing to the masked element
925
-
926
- Use this to do some extra processing of the input. This can be useful when implementing an alias, ex. decimal alias, autofill the digits when leaving the inputfield.
927
-
928
- Function arguments: event, buffer, caretPos, opts<br>Function return: command object (see [Define custom definitions](#define-custom-definitions))
929
-
930
- ### onUnMask
931
- Executes after unmasking to allow post-processing of the unmaskedvalue.
932
-
933
- Function arguments: maskedValue, unmaskedValue<br>Function return: processedValue
934
-
935
- ```javascript
936
- $(document).ready(function(){
937
- $("#number").inputmask("decimal", { onUnMask: function(maskedValue, unmaskedValue) {
938
- //do something with the value
939
- return unmaskedValue;
940
- }});
941
- });
942
- ```
943
-
944
- ### showMaskOnFocus
945
- Shows the mask when the input gets focus. (default = true)
946
-
947
- ```javascript
948
- $(document).ready(function(){
949
- $("#ssn").inputmask("999-99-9999",{ showMaskOnFocus: true }); //default
950
- });
951
- ```
952
-
953
- To make sure no mask is visible on focus also set the showMaskOnHover to false. Otherwise hovering with the mouse will set the mask and will stay on focus.
954
-
955
- ### showMaskOnHover
956
- Shows the mask when hovering the mouse. (default = true)
957
-
958
- ```javascript
959
- $(document).ready(function(){
960
- $("#ssn").inputmask("999-99-9999",{ showMaskOnHover: true }); //default
961
- });
962
- ```
963
-
964
- ### onKeyValidation
965
- Callback function is executed on every keyvalidation with the key, result as the parameter.
966
-
967
- ```javascript
968
- $(document).ready(function(){
969
- $("#ssn").inputmask("999-99-9999", {
970
- onKeyValidation: function (key, result) {
971
- console.log(key + " - " + result);
972
- }
973
- });
974
- });
975
- ```
976
-
977
- ### skipOptionalPartCharacter
978
-
979
- ### numericInput
980
- Numeric input direction. Keeps the caret at the end.
981
-
982
- ```javascript
983
- $(document).ready(function(){
984
- $(selector).inputmask('€ 999.999.999,99', { numericInput: true }); //123456 => € ___.__1.234,56
985
- });
986
- ```
987
-
988
- ### rightAlign
989
- Align the input to the right
990
-
991
- By setting the rightAlign you can specify to right-align an inputmask. This is only applied in combination op the numericInput option or the dir-attribute. The default is true.
992
-
993
- ```javascript
994
- $(document).ready(function(){
995
- $(selector).inputmask('decimal', { rightAlign: false }); //disables the right alignment of the decimal input
996
- });
997
- ```
998
-
999
- ### undoOnEscape
1000
- Make escape behave like undo. (ctrl-Z)<br>Pressing escape reverts the value to the value before focus.<br>Default: true
1001
-
1002
- ### radixPoint (numerics)
1003
- Define the radixpoint (decimal separator)<br>Default: ""
1004
-
1005
- ### groupSeparator (numerics)
1006
- Define the groupseparator<br>Default: ""
1007
-
1008
- ### keepStatic
1009
- Default: null (~false) Use in combination with the alternator syntax Try to keep the mask static while typing. Decisions to alter the mask will be postponed if possible.
1010
-
1011
- ex. $(selector).inputmask({ mask: ["+55-99-9999-9999", "+55-99-99999-9999", ], keepStatic: true });
1012
-
1013
- typing 1212345123 => should result in +55-12-1234-5123 type extra 4 => switch to +55-12-12345-1234
1014
-
1015
- **When the option is not set, it will default to false.**
1016
- **Except:**
1017
- - for multiple masks it will default to true
1018
- - when the first alternation is shorter then the next it will also default to true.
1019
- - ex: (9|999), (99)|(aaaa)
1020
-
1021
- ### positionCaretOnTab
1022
- When enabled the caret position is set after the latest valid position on TAB Default: true
1023
-
1024
- ### tabThrough
1025
- Allows for tabbing through the different parts of the masked field.<br>Default: false
1026
-
1027
- ### definitions
1028
- Pass custom definitions directly in the options.
1029
-
1030
- ```
1031
- Inputmask({
1032
- mask: "V{13}9{4}",
1033
- definitions: {
1034
- "V": {
1035
- validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
1036
- casing: "upper"
1037
- }
1038
- },
1039
- clearIncomplete: true,
1040
- autoUnmask: true
1041
- }).mask(selector);
1042
- ```
1043
-
1044
- ### isComplete
1045
- With this call-in (hook) you can override the default implementation of the isComplete function.<br>Args => buffer, opts Return => true|false
1046
-
1047
- ```javascript
1048
- $(selector).inputmask({
1049
- regex: "[0-9]*",
1050
- isComplete: function(buffer, opts) {
1051
- return new RegExp(opts.regex).test(buffer.join(''));
1052
- }
1053
- });
1054
- ```
1055
-
1056
- ### postValidation
1057
- Hook to postValidate the result from isValid. Usefull for validating the entry as a whole. Args => buffer, pos, c, currentResult, opts, maskset, strict, fromCheckval<br>Return => true|false|command object
1058
-
1059
- ### preValidation
1060
- Hook to preValidate the input. Useful for validating regardless of the definition. Args => buffer, pos, char, isSelection, opts, maskset, caretPos, strict => return true/false/command object
1061
- When returning true, the normal validation kicks in, otherwise, it is skipped.
1062
-
1063
- When returning a command object the actions are executed and further validation is stopped.
1064
- If you want to continue further validation, you need to add the rewritePosition action.
1065
-
1066
- ### staticDefinitionSymbol
1067
- The staticDefinitionSymbol option is used to indicate that the static entries in the mask can match a certain definition. Especially useful with alternators so that the static element in the mask can match another alternation.
1068
-
1069
- In the example below, we mark the spaces as a possible match for the "i" definition. By doing so the mask can alternate to the second mask even when we typed already "12 3".
1070
-
1071
- ```javascript
1072
- Inputmask("(99 99 999999)|(i{+})", {
1073
- definitions: {
1074
- "i": {
1075
- validator: ".",
1076
- definitionSymbol: "*"
1077
- }
1078
- },
1079
- staticDefinitionSymbol: "*"
1080
- }).mask(selector);
1081
- ```
1082
-
1083
- ### nullable
1084
- Return nothing when the user hasn't entered anything.
1085
- Default: true
1086
-
1087
- ### noValuePatching
1088
- Disable value property patching
1089
- Default: false
1090
-
1091
- ### positionCaretOnClick
1092
- Positioning of the caret on click.
1093
-
1094
- Options:
1095
- - none
1096
- - lvp (based on the last valid position (default)
1097
- - radixFocus (position caret to radixpoint on initial click)
1098
- - select (select the whole input)
1099
- - ignore (ignore the click and continue the mask)
1100
-
1101
- Default: "lvp"
1102
-
1103
- ### casing
1104
- Apply casing at the mask-level.
1105
- Options: null, "upper", "lower" or "title"
1106
- or callback args => elem, test, pos, validPositions return charValue
1107
-
1108
- ```
1109
- casing: function(elem, test, pos, validPositions) {
1110
- do some processing || upper/lower input property in the validPositions
1111
- return elem; //upper/lower element
1112
- }
1113
- ```
1114
- Default: null
1115
-
1116
- ### inputmode
1117
- Default: "text"
1118
- The inputmode hints at the type of data that might be entered by the user while editing the element or its contents.
1119
-
1120
- https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
1121
-
1122
- ### importDataAttributes
1123
- Specify to use the data-inputmask attributes or to ignore them.
1124
-
1125
- If you don't use data attributes you can disable the import by specifying importDataAttributes: false.
1126
-
1127
-
1128
- Default: true
1129
-
1130
- ### shiftPositions
1131
- Alter the behavior of the char shifting on entry or deletion.
1132
-
1133
- In some cases shifting the mask entries or deletion should be more restrictive.
1134
- Ex. date masks. Shifting month to day makes no sense
1135
-
1136
- Default: true
1137
-
1138
- true = shift on the "def" match
1139
- false = shift on the "nativeDef" match
1140
-
1141
- ### usePrototypeDefinitions
1142
- Use the default defined definitions from the prototype.
1143
-
1144
- Default: true
1145
-
1146
- ### validationEventTimeOut
1147
- Time to show html5 validation error on form submit.
1148
-
1149
- Default: 3000
1150
-
1151
- ### substitutes
1152
- Define character substitutes.
1153
- ```
1154
- substitutes: {
1155
- ",": "."
1156
- }
1157
- ```
1158
- Default: {}
1159
-
1160
- ## General
1161
- ### set a value and apply the mask
1162
- this can be done with the traditional jquery.val function (all browsers) or JavaScript value property for browsers which implement lookupGetter or getOwnPropertyDescriptor
1163
-
1164
- ```javascript
1165
- $(document).ready(function(){
1166
- $("#number").val(12345);
1167
-
1168
- var number = document.getElementById("number");
1169
- number.value = 12345;
1170
- });
1171
- ```
1172
-
1173
- with the autoUnmaskoption you can change the return of $.fn.val (or value property) to unmaskedvalue or the maskedvalue
1174
-
1175
- ```javascript
1176
- $(document).ready(function(){
1177
- $('#<%= tbDate.ClientID%>').inputmask({ "mask": "99/99/9999", 'autoUnmask' : true}); // value: 23/03/1973
1178
- alert($('#<%= tbDate.ClientID%>').val()); // shows 23031973 (autoUnmask: true)
1179
-
1180
- var tbDate = document.getElementById("<%= tbDate.ClientID%>");
1181
- alert(tbDate.value); // shows 23031973 (autoUnmask: true)
1182
- });
1183
- ```
1184
-
1185
- ### escape special mask chars
1186
-
1187
- If you want a mask element to appear as a static element you can escape them by \\
1188
-
1189
- ```javascript
1190
- $(document).ready(function(){
1191
- $("#months").inputmask("m \\months");
1192
- });
1193
- ```
1194
- Extra example see https://github.com/RobinHerbots/Inputmask/issues/2251
1195
-
1196
- ### auto-casing inputmask
1197
- You can define within a definition to automatically apply some casing on the entry in input by giving the casing.<br>Casing can be null, "upper", "lower" or "title".
1198
-
1199
- ```javascript
1200
- Inputmask.extendDefinitions({
1201
- 'A': {
1202
- validator: "[A-Za-z]",
1203
- casing: "upper" //auto uppercasing
1204
- },
1205
- '+': {
1206
- validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]",
1207
- casing: "upper"
1208
- }
1209
- });
1210
- ```
1211
-
1212
- Include jquery.inputmask.extensions.js for using the A and # definitions.
1213
-
1214
- ```javascript
1215
- $(document).ready(function(){
1216
- $("#test").inputmask("999-AAA"); // => 123abc ===> 123-ABC
1217
- });
1218
- ```
1219
-
1220
- ## Supported markup options
1221
- ### RTL attribute
1222
-
1223
- ```html
1224
- <input id="test" dir="rtl" />
1225
- ```
1226
-
1227
- ### readonly attribute
1228
-
1229
- ```html
1230
- <input id="test" readonly="readonly" />
1231
- ```
1232
-
1233
- ### disabled attribute
1234
-
1235
- ```html
1236
- <input id="test" disabled="disabled" />
1237
- ```
1238
-
1239
- ### maxlength attribute
1240
-
1241
- ```html
1242
- <input id="test" maxlength="4" />
1243
- ```
1244
-
1245
- ### data-inputmask attribute
1246
- You can also apply an inputmask by using the data-inputmask attribute. In the attribute, you specify the options wanted for the inputmask. This gets parsed with $.parseJSON (for the moment), so be sure to use a well-formed JSON-string without the {}.
1247
-
1248
- ```html
1249
- <input data-inputmask="'alias': 'datetime'" />
1250
- <input data-inputmask="'mask': '9', 'repeat': 10, 'greedy' : false" />
1251
- ```
1252
-
1253
- ```javascript
1254
- $(document).ready(function(){
1255
- $(":input").inputmask();
1256
- });
1257
- ```
1258
-
1259
- ### data-inputmask-<option\> attribute
1260
- All options can also be passed through data-attributes.
1261
-
1262
- ```html
1263
- <input data-inputmask-mask="9" data-inputmask-repeat="10" data-inputmask-greedy="false" />
1264
- ```
1265
-
1266
- ```javascript
1267
- $(document).ready(function(){
1268
- $(":input").inputmask();
1269
- });
1270
- ```
1271
-
1272
- ## jQuery.clone
1273
- When cloning a inputmask, the inputmask reactivates on the first event (mouseenter, focus, ...) that happens to the input. If you want to set a value on the cloned inputmask and you want to directly reactivate the masking you have to use $(input).inputmask("setvalue", value)
1274
-
1275
- Be sure to pass true in the jQuery.clone fn to clone with data and events and use jQuery as dependencyLib
1276
- (https://api.jquery.com/clone/)
1277
-
1278
-
1279
- [input-type-ref]: https://html.spec.whatwg.org/multipage/forms.html#do-not-apply