Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Options

Index

Properties

Optional SetMaxOnOverflow

SetMaxOnOverflow?: boolean

Set the maximum value when the user types a number which is greater that the value of max.

default

false

Optional alias

alias?: string

The alias to use.

default

null

Optional allowMinus

allowMinus?: boolean

Allow to enter -.

default

true

Optional alternatormarker

alternatormarker?: string

Definition of the symbols used to indicate an alternator part in the mask.

default

"|"

Optional autoUnmask

autoUnmask?: boolean

Automatically unmask the value when retrieved.

When setting this option to true the plugin also expects the initial value from the server to be unmasked.

default

false

Optional casing

casing?: Casing

Apply casing at the mask-level.

default

undefined

Optional clearIncomplete

clearIncomplete?: boolean

Clear the incomplete input on blur.

default

false

Optional clearMaskOnLostFocus

clearMaskOnLostFocus?: boolean

Remove the empty mask on blur or when not empty remove the optional trailing part.

default

true

Optional definitions

definitions?: {}

Add new definitions to this inputmask.

Type declaration

Optional digits

digits?: string | number

Number of fractionalDigits.

Possible values:

  • A number describing the number of fractional digits.
  • *
  • Quantifier syntax like 2,4. When the quantifier syntax is used, the digitsOptional option is ignored
default

"*"

Optional digitsOptional

digitsOptional?: boolean

Specify wheter the digits are optional.

default

true

Optional displayFormat

displayFormat?: string

Visual format when the input looses focus

Optional enforceDigitsOnBlur

enforceDigitsOnBlur?: boolean

Enforces the decimal part when leaving the input field.

default

false

Optional escapeChar

escapeChar?: string

Definition of the symbols used to escape a part in the mask.

default

"\"

Optional greedy

greedy?: boolean

Toggle to allocate as much possible or the opposite. Non-greedy repeat function. With the non-greedy option set to false, you can specify * as repeat. This makes an endless repeat.

default

false

Optional groupSeparator

groupSeparator?: string

Define the groupseparator.

default

""

Optional groupmarker

groupmarker?: Range

Definition of the symbols used to indicate a group in the mask.

default

{ start: "(", end: ")" }

Optional ignorables

ignorables?: number[]

Specify keyCodes which should not be considered in the keypress event, otherwise the preventDefault will stop their default behavior especially in FF.

Optional importDataAttributes

importDataAttributes?: boolean

Specify to use the data-inputmask attributes or to ignore them.

If you don't use data attributes you can disable the import by specifying importDataAttributes: false.

default

true

Optional inputFormat

inputFormat?: string

Format used to input a date. This option is only effective for the datetime alias.

Supported symbols

  • d - Day of the month as digits; no leading zero for single-digit days.
  • dd - Day of the month as digits; leading zero for single-digit days.
  • ddd - Day of the week as a three-letter abbreviation.
  • dddd - Day of the week as its full name.
  • m - Month as digits; no leading zero for single-digit months.
  • mm - Month as digits; leading zero for single-digit months.
  • mmm - Month as a three-letter abbreviation.
  • mmmm - Month as its full name.
  • yy - Year as last two digits; leading zero for years less than 10.
  • yyyy - Year as 4 digits.
  • h - Hours; no leading zero for single-digit hours (12-hour clock).
  • hh - Hours; leading zero for single-digit hours (12-hour clock).
  • hx - Hours; no limit; x = number of digits ~ use as h2, h3, ...
  • H - Hours; no leading zero for single-digit hours (24-hour clock).
  • HH - Hours; leading zero for single-digit hours (24-hour clock).
  • Hx - Hours; no limit; x = number of digits ~ use as H2, H3, ...
  • M - Minutes; no leading zero for single-digit minutes. Uppercase M unlike CF timeFormat's m to avoid conflict with months.
  • MM - Minutes; leading zero for single-digit minutes. Uppercase MM unlike CF timeFormat's mm to avoid conflict with months.
  • s - Seconds; no leading zero for single-digit seconds.
  • ss - Seconds; leading zero for single-digit seconds.
  • l - Milliseconds. 3 digits.
  • L - Milliseconds. 2 digits.
  • t - Lowercase, single-character time marker string: a or p.
  • tt - Two-character time marker string: am or pm.
  • T - Single-character time marker string: A or P.
  • TT - Two-character time marker string: AM or PM.
  • Z - US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the GMT/UTC offset is returned, e.g. GMT-0500
  • o - GMT/UTC timezone offset, e.g. -0500 or +0230.
  • S - The date's ordinal suffix (st, nd, rd, or th). Works well with d.
default

"isoDateTime"

Optional inputType

inputType?: "number" | "text"

Indicates whether the value passed for initialization is text or a number.

  • text - radixpoint should be the same as in the options
  • number - radixpoint should be a . as the default for a number in js
default

"text"

Optional inputmode

inputmode?: InputMode

Specify the inputmode - already in place for when browsers start to support them https://html.spec.whatwg.org/#input-modalities:-the-inputmode-attribute

default

"verbatim"

Optional insertMode

insertMode?: boolean

Toggle to insert or overwrite input. This option can be altered by pressing the Insert key.

default

true

Optional insertModeVisual

insertModeVisual?: boolean

Show selected caret when insertMode = false.

default

true

Optional isComplete

isComplete?: (buffer: string[], opts: Options) => boolean

Type declaration

    • (buffer: string[], opts: Options): boolean
    • With this call-in (hook) you can override the default implementation of the isComplete function.

      Parameters

      Returns boolean

Optional jitMasking

jitMasking?: boolean

Just in time masking. With the jitMasking option you can enable jit masking. The mask will only be visible for the user entered characters.

default

false

Optional keepStatic

keepStatic?: null | boolean

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.

ex. $(selector).inputmask({ mask: ["+55-99-9999-9999", "+55-99-99999-9999", ], keepStatic: true });

typing 1212345123 => should result in +55-12-1234-5123 type extra 4 => switch to +55-12-12345-1234

When the option is not set, it will default to false, except for multiple masks it will default to true!

Optional mask

mask?: string | string[] | ((opts: Options) => string | string[])

The mask to use.

Optional max

max?: string | number

Maximum value. This needs to be in the same format as the inputFormat when used with the datetime alias.

Optional min

min?: string | number

Minimum value. This needs to be in the same format as the inputFormat when used with the datetime alias.

Optional negationSymbol

negationSymbol?: { back: string; front: string }

Define your negationSymbol.

default

{ front: "-", back: "" }

Type declaration

  • back: string
  • front: string

Optional noValuePatching

noValuePatching?: boolean

Disable value property patching

default

false

Optional nullable

nullable?: boolean

Return nothing from the input value property when the user hasn't entered anything. If this is false, the mask might be returned.

default

true

Optional numericInput

numericInput?: boolean

Numeric input direction. Keeps the caret at the end.

default

false

Optional onBeforeMask

onBeforeMask?: (initialValue: string, opts: Options) => string

Type declaration

    • (initialValue: string, opts: Options): string
    • Executes before masking the initial value to allow preprocessing of the initial value.

      Parameters

      Returns string

Optional onBeforePaste

onBeforePaste?: (pastedValue: string, opts: Options) => string

Type declaration

    • (pastedValue: string, opts: Options): string
    • 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. You can also disable pasting a value by returning false in the onBeforePaste call.

      Parameters

      Returns string

Optional onBeforeWrite

onBeforeWrite?: (event: KeyboardEvent, buffer: string[], caretPos: number, opts: Options) => CommandObject

Type declaration

    • Executes before writing to the masked element. 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.

      Parameters

      • event: KeyboardEvent
      • buffer: string[]
      • caretPos: number
      • opts: Options

      Returns CommandObject

Optional onKeyDown

onKeyDown?: (event: KeyboardEvent, buffer: string[], caretPos: { begin: number; end: number }, opts: Options) => void

Type declaration

    • (event: KeyboardEvent, buffer: string[], caretPos: { begin: number; end: number }, opts: Options): void
    • Callback to implement autocomplete on certain keys for example.

      Parameters

      • event: KeyboardEvent
      • buffer: string[]
      • caretPos: { begin: number; end: number }
        • begin: number
        • end: number
      • opts: Options

      Returns void

Optional onKeyValidation

onKeyValidation?: (key: number, result: boolean) => void

Type declaration

    • (key: number, result: boolean): void
    • Callback function is executed on every keyvalidation with the key, result as the parameter.

      Parameters

      • key: number
      • result: boolean

      Returns void

Optional onUnMask

onUnMask?: (maskedValue: string, unmaskedValue: string) => string

Type declaration

    • (maskedValue: string, unmaskedValue: string): string
    • Executes after unmasking to allow post-processing of the unmaskedvalue.

      Parameters

      • maskedValue: string
      • unmaskedValue: string

      Returns string

      New unmasked value

Optional oncleared

oncleared?: () => void

Type declaration

    • (): void
    • Execute a function when the mask is cleared.

      Returns void

Optional oncomplete

oncomplete?: () => void

Type declaration

    • (): void
    • Execute a function when the mask is completed.

      Returns void

Optional onincomplete

onincomplete?: () => void

Type declaration

    • (): void
    • Execute a function when the mask is cleared.

      Returns void

Optional optionalmarker

optionalmarker?: Range

Definition of the symbols used to indicate an optional part in the mask.

default

{ start: "[", end: "]" }

Optional outputFormat

outputFormat?: string

Format of the unmasked value. This is only effective when used with the datetime alias.

Optional placeholder

placeholder?: string

Change the mask placeholder. Instead of "_", you can change the unfilled characters mask as you like, simply by adding the placeholder option. For example, placeholder: " " will change the default autofill with empty values.

default

"_"

Optional positionCaretOnClick

positionCaretOnClick?: PositionCaretOnClick

Positioning of the caret on click.

Options:

  • none
  • lvp - based on the last valid position (default)
  • radixFocus - position caret to radixpoint on initial click
  • select - select the whole input
  • ignore - ignore the click and continue the mask
default

"lvp"

Optional positionCaretOnTab

positionCaretOnTab?: boolean

When enabled the caret position is set after the latest valid position on TAB.

default

true

Optional postValidation

postValidation?: (buffer: string[], pos: number, char: string, currentResult: boolean, opts: Options, maskset: any, strict: boolean, fromCheckval: boolean) => boolean | CommandObject

Type declaration

    • (buffer: string[], pos: number, char: string, currentResult: boolean, opts: Options, maskset: any, strict: boolean, fromCheckval: boolean): boolean | CommandObject
    • Hook to postValidate the result from isValid. Useful for validating the entry as a whole.

      Parameters

      • buffer: string[]
      • pos: number
      • char: string
      • currentResult: boolean
      • opts: Options
      • maskset: any
      • strict: boolean
      • fromCheckval: boolean

      Returns boolean | CommandObject

Optional preValidation

preValidation?: (buffer: string[], pos: number, char: string, isSelection: boolean, opts: Options, maskset: any, caretPos: { begin: number; end: number }, strict: boolean) => boolean | CommandObject

Type declaration

    • (buffer: string[], pos: number, char: string, isSelection: boolean, opts: Options, maskset: any, caretPos: { begin: number; end: number }, strict: boolean): boolean | CommandObject
    • Hook to preValidate the input. Useful for validating regardless of the definition.

      When returning true, the normal validation kicks in, otherwise, it is skipped.

      When returning a command object the actions are executed and further validation is stopped. If you want to continue further validation, you need to add the rewritePosition action.

      Parameters

      • buffer: string[]
      • pos: number
      • char: string
      • isSelection: boolean
      • opts: Options
      • maskset: any
      • caretPos: { begin: number; end: number }
        • begin: number
        • end: number
      • strict: boolean

      Returns boolean | CommandObject

Optional prefillYear

prefillYear?: boolean

Enable/disable prefilling of the year. Although you can just over type the proposed value without deleting, many seems to see a problem with the year prediction. This options is to disable this feature.

default

true

Optional prefix

prefix?: string

Define a prefix.

default

""

Optional quantifiermarker

quantifiermarker?: Range

Definition of the symbols used to indicate a quantifier in the mask.

default

{ start: "{", end: "}" }

Optional radixPoint

radixPoint?: string

Define the radixpoint (decimal separator)

default

""

Optional regex

regex?: string

Use a regular expression as a mask. When using shorthands be aware that you need to double escape or use String.raw with a string literal.

Optional removeMaskOnSubmit

removeMaskOnSubmit?: boolean

Remove the mask before submitting the form.

default

false

Optional repeat

repeat?: string | number

Mask repeat function. Repeat the mask definition x-times. * ~ forever, otherwise specify an integer

default

0

Optional rightAlign

rightAlign?: boolean

Align the input to the right

By setting the rightAlign you can specify to right-align an inputmask. This is only applied in combination of the numericInput option or the dir-attribute.

default

true

Optional roundingFN

roundingFN?: (input: number) => number

Type declaration

    • (input: number): number
    • Set the function for rounding the values when set.

      Other examples:

      • Math.floor
      • fn(x) { // do your own rounding logic // return x; }

      Parameters

      • input: number

      Returns number

Optional shiftPositions

shiftPositions?: boolean

Alter the behavior of the char shifting on entry or deletion.

In some cases shifting the mask entries or deletion should be more restrictive.

Ex. date masks. Shifting month to day makes no sense

default

true

Optional shortcuts

shortcuts?: null | {}

Define shortcuts. This will allow typing 1k => 1000, 2m => 2000000

To disable just pass shortcuts: null as option

default

{k: "000", m: "000000"}

Optional showMaskOnFocus

showMaskOnFocus?: boolean

Shows the mask when the input gets focus.

default

true

Optional showMaskOnHover

showMaskOnHover?: boolean

Shows the mask when the input is hevered by the mouse cursor.

default

true

Optional skipOptionalPartCharacter

skipOptionalPartCharacter?: string

A character which can be used to skip an optional part of a mask.

default

" "

Optional staticDefinitionSymbol

staticDefinitionSymbol?: string

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 static element in the mask can match another alternation.

default

undefined

Optional step

step?: number

Define the step the ctrl-up & ctrl-down must take.

default

1

Optional suffix

suffix?: string

Define a suffix.

default

""

Optional supportsInputType

supportsInputType?: string[]

List with the supported input types

default

["text", "tel", "url", "password", "search"]

Optional tabThrough

tabThrough?: boolean

Allows for tabbing through the different parts of the masked field.

default

false

Optional undoOnEscape

undoOnEscape?: boolean

Make escape behave like undo. (ctrl-Z) Pressing escape reverts the value to the value before focus.

default

true

Optional unmaskAsNumber

unmaskAsNumber?: boolean

Make unmasking returning a number instead of a string.

Be warned that using the unmaskAsNumber option together with jQuery.serialize will fail as serialize expects a string. (See issue #1288)

default

false

Optional usePrototypeDefinitions

usePrototypeDefinitions?: boolean

Use the default defined definitions from the prototype.

default

true

Generated using TypeDoc