Skip to content

Options

Every AutoNumeric option, with a live input to try each of its choices.

Options let you control precisely how an AutoNumeric-managed element formats your keystrokes as you type. For installation, methods and events, read the complete documentation.

Build your own configuration

Select the options you need in the configurator and copy the generated object into your code.

OptionDescriptionDefault value
allowDecimalPaddingDefines if the decimal places should be padded with zeroestrue
alwaysAllowDecimalCharacterDefines if the decimal character or decimal character alternative should be accepted when there is already a decimal character shown in the element.false
caretPositionOnFocusDefines where should be positioned the caret on focusnull
createLocalListDefines if a local list of AutoNumeric objects should be kept when initializing this object.true
currencySymbolDefines the currency symbol string.''
currencySymbolPlacementDefines where the currency symbol should be placed (before of after the numbers)'p'
decimalCharacterDefines what decimal separator character is used'.'
decimalCharacterAlternativeAllow to declare an alternative decimal separator which is automatically replaced by `decimalCharacter` when typednull
decimalPlacesDefines the default number of decimal places to show on the formatted value, and keep for the precision2
decimalPlacesRawValueDefines how many decimal places should be kept for the raw value rawValuenull
decimalPlacesShownOnBlurDefines how many decimal places should be visible when the element is unfocusednull
decimalPlacesShownOnFocusDefines how many decimal places should be visible when the element has the focusnull
defaultValueOverrideHelper option for Asp.net postbacknull
digitalGroupSpacingDefines how many numbers should be grouped together'3'
digitGroupSeparatorDefines the thousand grouping separator character','
divisorWhenUnfocusedThe number that divides the element value on focusnull
emptyInputBehaviorDefines what should be displayed in the element if the raw value is an empty string '''focus'
eventBubblesDefines if the custom and native events triggered by AutoNumeric should bubble up or nottrue
eventIsCancelableDefines if the custom and native events triggered by AutoNumeric should be cancelabletrue
failOnUnknownOptionThis option is AutoNumeric's "strict mode" (aka 'debug' mode), which allows autoNumeric to strictly analyse the options given by the user, and fails if an unknown options is used in the settings objectfalse
formatOnPageLoadDetermine if the default value will be formatted on initializationtrue
formulaModeDefines if the formula mode can be activated by the userfalse
historySizeSet the undo/redo history table size20
isCancellableAllow the user to cancel and undo the changes he made to the given autonumeric-managed element, by pressing the Escape keytrue
leadingZeroControls the leading zero behavior'deny'
maximumValueDefines the maximum possible value a user can enter'10000000000000'
minimumValueDefines the minimum possible value a user can enter'-10000000000000'
modifyValueOnWheelAllows the user to increment or decrement the element value with the mouse wheeltrue
negativeBracketsTypeOnBlurAdds brackets-like characters on negative values when unfocusednull
negativePositiveSignPlacementPlacement of the negative/positive sign relative to the currencySymbol optionnull
negativeSignCharacterDefines the negative sign symbol to use'-'
noEventListenersDefines if the element should have event listeners activated on itfalse
onInvalidPasteManage how autoNumeric react when the user tries to paste an invalid number'error'
outputFormatDefines how the value should be formatted when wanting a localized version of it'string'
overrideMinMaxLimitsOverride the minimum and maximum limitsnull
positiveSignCharacterDefines the positive sign symbol to use'+'
rawValueDivisorDivides the formatted value shown in the AutoNumeric element and store the divided result in rawValuenull
readOnlyDefines if the element (<input> or another allowed html tag) should be set as read only on initializationfalse
roundingMethodDefines the rounding method to use'S'
saveValueToSessionStorageSet to true to allow the decimalPlacesShownOnFocus value to be saved with sessionStoragefalse
selectNumberOnlyDetermine if the select all keyboard command will select the complete input text, or only the input numeric valuetrue
selectOnFocusDefines if the element value should be selected on focustrue
serializeSpacesDefines how the serialize functions should treat the spaces'+'
showOnlyNumbersOnFocusDefines if the element value should be converted to the raw value on focus or mouseenter, (and back to the formatted on blur or mouseleave)false
showPositiveSignAllow the positive sign symbol positiveSignCharacter to be displayed for positive numbersfalse
showWarningsDefines if warnings should be shown in the consoletrue
styleRulesDefines the rules that calculate the CSS class(es) to apply on the element, based on the raw unformatted valuenull
suffixTextAdd a text on the right hand side of the element value''
symbolWhenUnfocusedDefines the symbol placed as a suffix when not in focus or hovered''
unformatOnHoverDefines if the element value should be unformatted when the user hover his mouse over it while holding the Alt keytrue
unformatOnSubmitWhen a submit event is detected in the parent form element, temporarily removes the formatting and set the rawValue in each AutoNumeric child elementsfalse
valuesToStringsProvides a way for automatically replacing the formatted value with a pre-defined string, when the raw value is equal to a specific valuenull
watchExternalChangesDefines if the AutoNumeric element should watch external changes made without using .set()false
wheelOnDefines when the wheel event will increment or decrement the element value'focus'
wheelStepDefines by how much the element value should be incremented/decremented on the wheel event'progressive'

allowDecimalPadding3 choicesOpen in the configurator

Defines if the decimal places should be padded with zeroes

Allow padding the decimal places with zeros. If set to 'floats', padding is only done when there are some decimals.

Note: setting allowDecimalPadding to false will override the decimalPlaces option

ChoiceValueTry itDescription
alwaystrueAlways pad decimals with zeros (ie. '12.3400')Default value
neverfalseNever pad with zeros (ie. '12.34')
floats'floats'Pad with zeroes only when there are decimals (ie. '12' and '12.3400')

rawValue:

alwaysAllowDecimalCharacter2 choicesOpen in the configurator

Defines if the decimal character or decimal character alternative should be accepted when there is already a decimal character shown in the element.

If set to true, any decimal character input will be accepted and will subsequently modify the decimal character position, as well as the rawValue.
If set to false, the decimal character and its alternative key will be dropped. This is the default setting.
ChoiceValueTry itDescription
alwaysAllowtrueAllow entering a decimal character even if one is already present in the number
doNotAllowfalsePrevent the insertion of the decimal character if one is already used in the numberDefault value

rawValue:

caretPositionOnFocus5 choicesOpen in the configurator

Defines where should be positioned the caret on focus

ChoiceValueTry itDescription
start'start'Put the caret of the far left side of the value (excluding the positive/negative sign and currency symbol, if any)
end'end'Put the caret of the far right side of the value (excluding the positive/negative sign and currency symbol, if any)
decimalLeft'decimalLeft'Put the caret of the left of the decimal character if any
decimalRight'decimalRight'Put the caret of the right of the decimal character if any
doNoForceCaretPositionnullDo not enforce any caret positioning on focus (this is needed when using `selectOnFocus`)Default value

rawValue:

createLocalList2 choicesOpen in the configurator

Defines if a local list of AutoNumeric objects should be kept when initializing this object.

This list is used by the global.* functions

ChoiceValueTry itDescription
createListtrueAllow the creation of the local listDefault value
doNotCreateListfalsePrevent the creation of the local list

rawValue:

currencySymbol44 choices, or your own valueOpen in the configurator

Defines the currency symbol string.

It can be a string of more than one character (allowing for instance to use a space on either side of it, example: '$ ' or ' $')
ChoiceValueTry itDescription
none''Default value
currencySign'¤'
austral'₳'ARA
australCentavo'¢'
baht'฿'THB
cedi'₵'GHS
cent'¢'
colon '₡'CRC
cruzeiro'₢'BRB - Not used anymore since 1993
dollar '$'
dong'₫'VND
drachma'₯'GRD (or 'Δρχ.' or 'Δρ.')
dram'​֏​'AMD
european'₠'XEU (old currency before the Euro)
euro'€'EUR
florin'ƒ'
franc'₣'FRF
guarani'₲'PYG
hryvnia'₴'грн
kip'₭'LAK
att'ອັດ'cents of the Kip
lepton 'Λ'cents of the Drachma
lira '₺'TRY
liraOld'₤'
lari'₾'GEL
mark'ℳ'
mill'₥'
naira'₦'NGN
peseta'₧'
peso'₱'PHP
pfennig'₰'cents of the Mark
pound'£'
real'R$'Brazilian real
riel'៛'KHR
ruble'₽'RUB
rupee'₹'INR
rupeeOld'₨'
shekel'₪'
shekelAlt'ש״ח'
taka'৳'BDT
tenge'₸'KZT
togrog'₮'MNT
won'₩'
yen'¥'
You can use a custom choice for this option

rawValue:

currencySymbolPlacement2 choicesOpen in the configurator

Defines where the currency symbol should be placed (before of after the numbers)

ChoiceValueTry itDescription
prefix'p'Placed before the numbersDefault value
suffix's'Placed after the numbers

rawValue:

decimalCharacter5 choicesOpen in the configurator

Defines what decimal separator character is used

You can enter the custom decimal character by entering the . character as usual

ChoiceValueTry itDescription
comma','
dot'.'Default value
middleDot'·'
arabicDecimalSeparator'٫'
decimalSeparatorKeySymbol'⎖'

rawValue:

decimalCharacterAlternative3 choices, or your own valueOpen in the configurator

Allow to declare an alternative decimal separator which is automatically replaced by `decimalCharacter` when typed

This is useful for countries that use a comma ',' as the decimal character and have keyboards with numeric pads providing a period '.' as the decimal character (in France or Spain for instance)
ChoiceValueTry itDescription
nonenullNo alternative character is defined for entering the decimalCharacterDefault value
comma','Entering a comma ',' will enter the defined decimalCharacter
dot'.'Entering a dot '.' will enter the defined decimalCharacter
You can use a custom choice for this option

rawValue:

decimalPlaces7 choices, or your own valueOpen in the configurator

Defines the default number of decimal places to show on the formatted value, and keep for the precision

Incidentally, since we need to be able to show that many decimal places, this also defines the raw value precision by default
ChoiceValueTry itDescription
none0No decimal places are shown nor kept in the rawValue
one1One decimal place is shown and kept in the rawValue
two2Two decimal places are shown and kept in the rawValueDefault value
three3Three decimal places are shown and kept in the rawValue
four4Four decimal places are shown and kept in the rawValue
Five5Five decimal places are shown and kept in the rawValue
Six6Six decimal places are shown and kept in the rawValue
You can use a custom choice for this option

rawValue:

decimalPlacesRawValue8 choices, or your own valueOpen in the configurator

Defines how many decimal places should be kept for the raw value rawValue

In other words, this is the precision for float values.
If this option is set to null (which is the default), then the value of decimalPlaces is used for decimalPlacesRawValue as well.
Note: Setting this to a lower number of decimal places than the one to be shown will lead to confusion for the users.
ChoiceValueTry itDescription
useDefaultnullThis option is ignored and the decimalPlaces option value is used insteadDefault value
none0No decimal places are shown nor kept in the rawValue
one1One decimal place is shown and kept in the rawValue
two2Two decimal places are shown and kept in the rawValue
three3Three decimal places are shown and kept in the rawValue
four4Four decimal places are shown and kept in the rawValue
Five5Five decimal places are shown and kept in the rawValue
Six6Six decimal places are shown and kept in the rawValue
You can use a custom choice for this option

rawValue:

decimalPlacesShownOnBlur8 choices, or your own valueOpen in the configurator

Defines how many decimal places should be visible when the element is unfocused

If this is set to null, then this option is ignored, and the decimalPlaces option value will be used instead.
This means this is optional ; if omitted the decimal places will be the same when the input has the focus.

This option can be used in conjonction with the two other scale* options, which allows to display a different formatted value when the element is unfocused, while another formatted value is shown when focused.
For those scale* options to have any effect, divisorWhenUnfocused must not be null.
ChoiceValueTry itDescription
useDefaultnullThis option is ignored and the decimalPlaces option value is used insteadDefault value
none0No decimal places are shown nor kept in the rawValue
one1One decimal place is shown and kept in the rawValue
two2Two decimal places are shown and kept in the rawValue
three3Three decimal places are shown and kept in the rawValue
four4Four decimal places are shown and kept in the rawValue
Five5Five decimal places are shown and kept in the rawValue
Six6Six decimal places are shown and kept in the rawValue
You can use a custom choice for this option

rawValue:

decimalPlacesShownOnFocus8 choices, or your own valueOpen in the configurator

Defines how many decimal places should be visible when the element has the focus

If this is set to null, then this option is ignored, and the decimalPlaces option value will be used instead.

Example:
For instance if decimalPlacesShownOnFocus is set to 5 and the default number of decimal places is 2, then on focus 1,000.12345 will be shown, while without focus 1,000.12 will be set back.
Note 1: the results depends on the rounding method used.
Note 2: the getNumericString() method returns the extended decimal places
ChoiceValueTry itDescription
useDefaultnullThis option is ignored and the decimalPlaces option value is used insteadDefault value
none0No decimal places are shown nor kept in the rawValue
one1One decimal place is shown and kept in the rawValue
two2Two decimal places are shown and kept in the rawValue
three3Three decimal places are shown and kept in the rawValue
four4Four decimal places are shown and kept in the rawValue
Five5Five decimal places are shown and kept in the rawValue
Six6Six decimal places are shown and kept in the rawValue
You can use a custom choice for this option

rawValue:

defaultValueOverride1 choice, or your own valueOpen in the configurator

Helper option for Asp.net postback

This should be set as the value of the unformatted default value
Examples:
no default value="" {defaultValueOverride: ""}
value=1234.56 {defaultValueOverride: '1234.56'}

If you do not use Asp.net, you can ignore that option

ChoiceValueTry itDescription
doNotOverridenullDefault value
You can use a custom choice for this option

rawValue:

digitalGroupSpacing4 choicesOpen in the configurator

Defines how many numbers should be grouped together

This is used for defining the thousand separators number grouping
ChoiceValueTry itDescription
two'2'India's lakhs
twoScaled'2s'India's lakhs scaled
three'3'The default groupingDefault value
four'4'Used in some Asian countries

rawValue:

digitGroupSeparator10 choicesOpen in the configurator

Defines the thousand grouping separator character

Example:
If '.' is set, then you'll get '1.234.567'

Note: the decimalCharacter and digitGroupSeparator cannot be the same character

ChoiceValueTry itDescription
comma','US-styleDefault value
dot'.'Europe-style
normalSpace' '
thinSpace' 'The unicode character is \u2009
narrowNoBreakSpace' 'The unicode character is \u202f
noBreakSpace' 'The unicode character is \u00a0
noSeparator''
apostrophe'''
arabicThousandsSeparator'٬'
dotAbove'˙'

rawValue:

divisorWhenUnfocused4 choices, or your own valueOpen in the configurator

The number that divides the element value on focus

On blur, the element value is multiplied back.

Example:
Display percentages using { divisorWhenUnfocused: 100 } (or directly in the Html with <input data-divisor-when-unfocused="100">)
The divisor value can be an integer or a float (but in the latter case with some limitations).
Note: The getNumericString() method returns the full value, including the hidden decimals when unfocused.

Warning: Using a non-integer divisor can lead to precision problems due to Javascript limitations when handling float numbers

ChoiceValueTry itDescription
nonenullDefault value
percentage100
permille1000
basisPoint10000
You can use a custom choice for this option

rawValue:

emptyInputBehavior7 choices, or your own valueOpen in the configurator

Defines what should be displayed in the element if the raw value is an empty string ''

Depending of this option value, you can decide to either display nothing, only the currency symbol (on focus or only when a key is being pressed), the minimum value, or the maximum value.
ChoiceValueTry itDescription
null'null'When the element is empty, the rawValue and the element value/text is set to null . This also allows to set the value to null using anElement.set(null)
focus'focus'The currency sign is displayed when the input receives focusDefault value
press'press'The currency sign is displayed whenever a key is being pressed
always'always'The currency sign is always displayed
min'min'The minimumValue is displayed on blur
max'max'The maximumValue is displayed on blur
zero'zero'A zero is displayed ('rounded' with or without a currency sign) if the input has no value on focus out
You can use a custom choice for this option

rawValue:

eventBubbles2 choicesOpen in the configurator

Defines if the custom and native events triggered by AutoNumeric should bubble up or not

Note: this also affects the native input and change events

ChoiceValueTry itDescription
bubblestrueAll native and custom events will bubble upDefault value
doesNotBubblefalseNo events dispatched by AutoNumeric will bubble up

rawValue:

eventIsCancelable2 choicesOpen in the configurator

Defines if the custom and native events triggered by AutoNumeric should be cancelable

Note: this also affects the native input and change events

ChoiceValueTry itDescription
isCancelabletrueAll native and custom events will be cancelableDefault value
isNotCancelablefalseNo events dispatched by AutoNumeric will be cancelable

rawValue:

failOnUnknownOption2 choicesOpen in the configurator

This option is AutoNumeric's "strict mode" (aka 'debug' mode), which allows autoNumeric to strictly analyse the options given by the user, and fails if an unknown options is used in the settings object

You should set that to true if you want to make sure you are only using pure autoNumeric settings objects in your code.
If you see uncaught errors in the console and your code starts to fail, this means somehow those options gets polluted by another script (which usually happens when using frameworks).

Do note that using the 'fail' value WILL make the AutoNumeric element initialization fail, as intended, since the option object is 'decorated' by Vue, which adds other properties to the option object. Check the console to see the failures.

ChoiceValueTry itDescription
failtrue
ignorefalseDefault value

rawValue:

formatOnPageLoad2 choicesOpen in the configurator

Determine if the default value will be formatted on initialization

ChoiceValueTry itDescription
formattrueAutomatically formats the default value on initializationDefault value
doNotFormatfalseWill not format the default value on initialization

rawValue:

formulaMode2 choicesOpen in the configurator

Defines if the formula mode can be activated by the user

If set to true, then the user can enter the formula mode by entering the '=' character.
He will then be allowed to enter any simple math formula using numeric characters as well as the following operators: +, -, *, /, ( and ).
The formula mode is exited when the user either validate their math expression using the Enter key, or when the element is blurred.
If the formula is invalid, the previous valid rawValue is set back, and the autoNumeric:invalidFormula event is sent.
When a valid formula is accepted, then its result is set(), and the autoNumeric:validFormula event is sent.
ChoiceValueTry itDescription
enabledtrueEnable the formula mode
disabledfalseDisable the formula modeDefault value

rawValue:

historySize6 choices, or your own valueOpen in the configurator

Set the undo/redo history table size

Each record keeps the raw value rawValue as well and the last known caret position / selection

Warning: Using a large number here is not advised. The larger the number, the larger the memory used.

ChoiceValueTry itDescription
verySmall5
small10
medium20Default value
large50
veryLarge100
insane9007199254740991This is equal to Number.MAX_SAFE_INTEGER
You can use a custom choice for this option

rawValue:

isCancellable2 choicesOpen in the configurator

Allow the user to cancel and undo the changes he made to the given autonumeric-managed element, by pressing the Escape key

Note: If the value has not been changed since last save, hitting Escape will select the input content (respecting the selectNumberOnly option).

Whenever the user validate the input (either by hitting Enter, or by blurring the element), the new value is saved for subsequent cancellation.

The process:
  • Save the input value on focus
  • If the user change the input value, and hit Escape, then the initial value saved on focus is set back
  • On the other hand if the user either have used Enter to validate his entries (Enter throws a change event), or if the input value has been changed by another script in the mean time, then we save the new input value
  • On a successful cancel, the whole value is selected (respecting the selectNumberOnly option)
ChoiceValueTry itDescription
cancellabletrueAllows using the Escape key to cancel the last edited changesDefault value
notCancellablefalseThe Escape key only select the element value, without undoing any changes

rawValue:

leadingZero3 choicesOpen in the configurator

Controls the leading zero behavior

This options describes if entering 0 on the far left of the numbers is allowed, and if the superfluous zeroes should be kept when the input is blurred
ChoiceValueTry itDescription
allow'allow'Allows leading zeros to be entered. Zeros will be truncated when entering additional digits. On focusout, zeros will be deleted
deny'deny'Allows only one leading zero on values that are between 1 and -1Default value
keep'keep'Allows leading zeros to be entered. On focusout, zeros will be kept

rawValue:

maximumValue3 choices, or your own valueOpen in the configurator

Defines the maximum possible value a user can enter

Notes:
  • This value must be a string and use the period for the decimal point
  • This value needs to be larger than minimumValue

Note: You can define a limit higher than Number.MAX_SAFE_INTEGER as text, and AutoNumeric will manage that correctly

ChoiceValueTry itDescription
tenTrillions'10000000000000'Default value
oneBillion'1000000000'
zero'0'
You can use a custom choice for this option

rawValue:

minimumValue3 choices, or your own valueOpen in the configurator

Defines the minimum possible value a user can enter

Notes:
  • This value must be a string and use the period for the decimal point
  • This value needs to be smaller than maximumValue

Warning: If minimumValue is superior to 0, then you'll effectively prevent your users to entirely delete the content of their AutoNumeric-managed element

ChoiceValueTry itDescription
tenTrillions'-10000000000000'Default value
oneBillion'-1000000000'
zero'0'
You can use a custom choice for this option

rawValue:

modifyValueOnWheel2 choicesOpen in the configurator

Allows the user to increment or decrement the element value with the mouse wheel

The wheel behavior can be modified by the wheelStep option. This wheelStep option can be used in two ways, either by setting:
  • a fixed step value (wheelStep : 1000), or
  • the 'progressive' string (wheelStep : 'progressive'), which will then activate a special mode where the step is automatically calculated based on the element value size.
Note:
  • A special behavior is applied in order to avoid preventing the user scrolling the page if the inputs are covering the whole available space.
  • You can use the Shift modifier key while using the mouse wheel in order to temporarily disable the increment/decrement feature (useful on small screen where some badly configured inputs could use all the available space).

You can use the Shift modifier key while using the mouse wheel in order to temporarily disable the increment/decrement feature

ChoiceValueTry itDescription
modifyValuetrueAllows using the wheel event to either increment of decrement the element valueDefault value
doNothingfalseThe wheel event is ignored

rawValue:

negativeBracketsTypeOnBlur11 choicesOpen in the configurator

Adds brackets-like characters on negative values when unfocused

Those brackets are visible only when the field does not have the focus.
The left and right symbols should be enclosed in quotes and separated by a comma ,.
For instance, this transforms -$ 999.99 to ($999.99) when unfocused.
ChoiceValueTry itDescription
parentheses'(,)'This notation is used in accounting in North America
brackets'[,]'
chevrons'<,>'
curlyBraces'{,}'
angleBrackets'〈,〉'
japaneseQuotationMarks'「,」'
halfBrackets'⸤,⸥'
whiteSquareBrackets'⟦,⟧'
quotationMarks'‹,›'
guillemets'«,»'
nonenullDefault value

rawValue:

negativePositiveSignPlacement5 choicesOpen in the configurator

Placement of the negative/positive sign relative to the currencySymbol option

The sign is placed on either side of the currencySymbol, which can be placed on either side of the numbers.

This is all the possible combinations:
  • -1,234.56 : The default (no particular options required)
  • -$1,234.56 : {currencySymbol: "$"} or {currencySymbol: "$", negativePositiveSignPlacement: "l"}
  • $-1,234.56 : {currencySymbol: "$", negativePositiveSignPlacement: "r"}. Default if negativePositiveSignPlacement is null and currencySymbol is not empty
  • -1,234.56$ : {currencySymbol: "$", currencySymbolPlacement: "s", negativePositiveSignPlacement: "p"}. Default if negativePositiveSignPlacement is null and currencySymbol is not empty
  • 1,234.56- : {negativePositiveSignPlacement: "s"}
  • $1,234.56- : {currencySymbol: "$", negativePositiveSignPlacement: "s"}
  • 1,234.56-$ : {currencySymbol: "$", currencySymbolPlacement: "s"}
  • 1,234.56$- : {currencySymbol: "$", currencySymbolPlacement: "s", negativePositiveSignPlacement: "r"}
ChoiceValueTry itDescription
prefix'p'This notation is used in accounting in North America
suffix's'
left'l'
right'r'
nonenullDefault value

rawValue:

negativeSignCharacter12 choices, or your own valueOpen in the configurator

Defines the negative sign symbol to use

It can be a string of only one character
ChoiceValueTry itDescription
hyphen'-'Default value
minus'−'
heavyMinus'➖'
fullWidthHyphen'-'
circledMinus'⊖'
squaredMinus'⊟'
triangleMinus'⨺'
plusMinus'±'
minusPlus'∓'
dotMinus'∸'
minusTilde'≂'
not'¬'
You can use a custom choice for this option

rawValue:

noEventListeners2 choicesOpen in the configurator

Defines if the element should have event listeners activated on it

By default, those event listeners are only added to <input> elements and html element with the contenteditable attribute set to true, but not on the other html tags.
Setting this to true allows to initialize elements without any event listeners.

Warning: Since AutoNumeric will not check the input content after its initialization, using some autoNumeric methods afterwards will probably leads to formatting problems

ChoiceValueTry itDescription
noEventstrueSince AutoNumeric will not monitor the user input, it's probably best to use this option in conjonction with the readOnly one
addEventsfalseThe AutoNumeric-managed element will be reactiveDefault value

rawValue:

onInvalidPaste5 choicesOpen in the configurator

Manage how autoNumeric react when the user tries to paste an invalid number

Note 1: A paste content starting with a negative sign '-' will be accepted anywhere in the input, and will set the resulting value as a negative number
Note 2: A paste content starting with a number will be accepted, even if the rest is gibberish (ie. '123foobar456'). In that case, only the first number will be used ('123' here).
Note 3: The paste event works with the decimalPlacesShownOnFocus option too.
ChoiceValueTry itDescription
error'error'The input value is not changed and an error is output in the consoleDefault value
ignore'ignore'Idem than 'error', but fails silently without outputting any error/warning in the console
clamp'clamp'If the pasted value is either too small or too big regarding the minimumValue and maximumValue range, then the result is clamped to those limits
truncate'truncate'autoNumeric will insert as many pasted numbers it can at the initial caret/selection, until everything is pasted, or the range limit is hit.
The non-pasted numbers are dropped and therefore not used at all.
replace'replace'autoNumeric will first insert as many pasted numbers it can at the initial caret/selection, then if the range limit is hit, it will try to replace one by one the remaining initial numbers (on the right side of the caret) with the rest of the pasted numbers.

rawValue:

outputFormat9 choicesOpen in the configurator

Defines how the value should be formatted when wanting a localized version of it

Note: The hyphen '-' is translated to the custom negative sign defined in negativeSignCharacter
ChoiceValueTry itDescription
string'string'nnnn.nn or -nnnn.nn as text typeDefault value
number'number'nnnn.nn or -nnnn.nn as a Number. Warning: this works only for integers inferior to Number.MAX_SAFE_INTEGER
dot'.'nnnn.nn or -nnnn.nn
negativeDot'-.'nnnn.nn or -nnnn.nn
comma','nnnn,nn or -nnnn,nn
negativeComma'-,'nnnn,nn or -nnnn,nn
dotNegative'.-'nnnn.nn or nnnn.nn-
commaNegative',-'nnnn,nn or nnnn,nn-
nonenullnnnn.nn or -nnnn.nn as text type

rawValue:

overrideMinMaxLimits5 choicesOpen in the configurator

Override the minimum and maximum limits

ChoiceValueTry itDescription
ceiling'ceiling'Adheres to maximumValue and ignores minimumValue settings.
It allows the user to enter anything between -∞ and maximumValue. If maximumValue is less than 0, then it will prevent the user emptying the field or typing value above maximumValue, making sure the value entered is always valid.
floor'floor'Adheres to minimumValue and ignores maximumValue settings.
It allows the user to enter anything between minimumValue and +∞. If minimumValue is higher than 0, then it will prevent the user emptying the field or typing value below minimumValue, making sure the value entered is always valid.
ignore'ignore'Ignores both minimumValue & maximumValue.
When using this option, the field will always be valid range-wise.
invalid'invalid'The user can temporarily type out-of-bound values. In doing so, the invalid state is set on the field. Whenever an invalid value is typed, an 'autoNumeric:invalidValue' event is sent. When the value is correctly set back within the limit boundaries, the invalid state is removed, and the 'autoNumeric:correctedValue' event is sent.
doNotOverridenullThe minimumValue and maximumValue limits are respected.
If 0 is out of the min/max range, this will prevent the user clearing the input field, making sure the value entered is always valid.
Default value

rawValue:

positiveSignCharacter16 choices, or your own valueOpen in the configurator

Defines the positive sign symbol to use

It can be a string of only one character.
This is shown only if showPositiveSign is set to true.
ChoiceValueTry itDescription
plus'+'Default value
fullWidthPlus'+'
heavyPlus'➕'
doublePlus'⧺'
triplePlus'⧻'
circledPlus'⊕'
squaredPlus'⊞'
trianglePlus'⨹'
plusMinus'±'
minusPlus'∓'
dotPlus'∔'
altHebrewPlus'﬩'
normalSpace' '
thinSpace' 'The unicode character is \u2009
narrowNoBreakSpace' 'The unicode character is \u202f
noBreakSpace' 'The unicode character is \u00a0
You can use a custom choice for this option

rawValue:

rawValueDivisor4 choices, or your own valueOpen in the configurator

Divides the formatted value shown in the AutoNumeric element and store the divided result in rawValue

Examples:
{ rawValueDivisor: '100' } or <input data-raw-value-divisor="100">
Given the 0.01234 raw value, the formatted value will be displayed as '1.234'.
This is useful when displaying percentage for instance, and avoid the need to divide/multiply by 100 between the number shown and the raw value.

Note: You can see the rawValue by pressing the Alt key and hovering your mouse over the input.

Warning: Using a non-integer divisor can lead to precision problems due to Javascript limitations when handling float numbers

ChoiceValueTry itDescription
nonenullDefault value
percentage100
permille1000
basisPoint10000
You can use a custom choice for this option

rawValue:

readOnly2 choicesOpen in the configurator

Defines if the element (<input> or another allowed html tag) should be set as read only on initialization

When set to true, then:
  • the readonly html property is added to the <input> element on initialization, or
  • the contenteditable attribute is set to false on non-input elements.
ChoiceValueTry itDescription
readOnlytrue
readWritefalseDefault value

rawValue:

roundingMethod13 choicesOpen in the configurator

Defines the rounding method to use

Multiple rounding methods are supported by AutoNumeric.
ChoiceValueTry itDescription
halfUpSymmetric'S'Round-Half-Up SymmetricDefault value
halfUpAsymmetric'A'Round-Half-Up Asymmetric
halfDownSymmetric's'Round-Half-Down Symmetric
halfDownAsymmetric'a'Round-Half-Down Asymmetric
halfEvenBankersRounding'B'Round-Half-Even "Bankers Rounding"
upRoundAwayFromZero'U'Round Up "Round-Away-From-Zero"
downRoundTowardZero'D'Round Down "Round-Toward-Zero".
This is the same as truncate.
toCeilingTowardPositiveInfinity'C'Round to Ceiling "Toward Positive Infinity"
toFloorTowardNegativeInfinity'F'Round to Floor "Toward Negative Infinity"
toNearest05'N05'Rounds to the nearest .05.
This is the same as the 'CHF' choice used in the old v1.9.x, which is still valid.
toNearest05Alt'CHF'Rounds to the nearest .05.
This is the same as 'N05'.
This is deprecated and will be removed in the future.
upToNext05'U05'Rounds up to next .05
downToNext05'D05'Rounds down to next .05

rawValue:

saveValueToSessionStorage2 choicesOpen in the configurator

Set to true to allow the decimalPlacesShownOnFocus value to be saved with sessionStorage

ChoiceValueTry itDescription
savetrueIf IE 6 or 7 are detected, the value will be saved as a session cookie
doNotSavefalseDefault value

rawValue:

selectNumberOnly2 choicesOpen in the configurator

Determine if the select all keyboard command will select the complete input text, or only the input numeric value

Note: If the currency symbol is between the numeric value and the negative sign, only the numeric value will be selected when doing Ctrl + a or ⌘ + a.
ChoiceValueTry itDescription
selectNumbersOnlytrueOnly the numbers and the negative/positive sign are selectedDefault value
selectAllfalseEverything is selected, including the currency symbol and the suffix text

rawValue:

selectOnFocus2 choicesOpen in the configurator

Defines if the element value should be selected on focus

Note: The selection is done using the selectNumberOnly option.
ChoiceValueTry itDescription
selecttrueDefault value
doNotSelectfalseOn focus, the input content is not selected if the browser does not enforce that behavior (which most of those do)

rawValue:

serializeSpaces2 choicesOpen in the configurator

Defines how the serialize functions should treat the spaces

Those spaces ' ' can either be converted to the plus sign '+', which is the default, or to '%20'.

Both values are valid according to the official specification.

However this stackoverflow answer sums up the situation pretty well: In an URL, spaces should be converted to '%20' before the '?' sign, then converted to '+' after.
In our case since we serialize the query, we use '+' as the default (but allow the user to get back the old wrong behavior).
ChoiceValueTry itDescription
plus'+'Current behaviorDefault value
percent'%20'Old behavior

rawValue:

showOnlyNumbersOnFocus2 choicesOpen in the configurator

Defines if the element value should be converted to the raw value on focus or mouseenter, (and back to the formatted on blur or mouseleave)

If set to true, then autoNumeric removes the thousand separator, currency symbol and suffix on focus and mouseenter.

Example:
If the input value is '+$ 1,999.88 suffix', on focus it becomes '1999.88' and back to '+$ 1,999.88 suffix' on blur.
ChoiceValueTry itDescription
onlyNumberstrue
showAllfalseDefault value

rawValue:

showPositiveSign2 choicesOpen in the configurator

Allow the positive sign symbol positiveSignCharacter to be displayed for positive numbers

The sign placement is controlled by the negativePositiveSignPlacement option, mimicking the negative sign placement rules.
ChoiceValueTry itDescription
showtrue
hidefalseDefault value

rawValue:

showWarnings2 choicesOpen in the configurator

Defines if warnings should be shown in the console

Those warnings can be ignored, but are usually printed when something could be improved by the user (ie. option conflicts).

Not much to see here, you would have to check the console for warning messages in your code

ChoiceValueTry itDescription
showtrueDefault value
hidefalse

rawValue:

styleRules5 choices, or your own valueOpen in the configurator

Defines the rules that calculate the CSS class(es) to apply on the element, based on the raw unformatted value

This can also be used to call callbacks whenever the `rawValue` is updated.
Important: all callbacks must return null if no ranges/userDefined classes are selected.

If you do not want / can't listen to the 'autoNumeric:rawValueModified' event when the rawValue is modified, you can use the styleRules option to define as many callbacks you need.
Those callbacks will be called whenever the rawValue is modified.

ChoiceValueTry itDescription
nonenullDefault value
positiveNegative{"positive":"autoNumeric-positive","negative":"autoNumeric-negative"}
range0To100With4Steps{"ranges":[{"min":0,"max":25,"class":"autoNumeric-red"},{"min":25,"max":50,"class":"autoNumeric-orange"},{"min":50,"max":75,"class":"autoNumeric-yellow"},{"min":75,"max":100,"class":"autoNumeric-green"}]}
evenOdd{"userDefined":[{"classes":["autoNumeric-even","autoNumeric-odd"]}]}The value here is not correctly displayed since callback is not displayed
rangeSmallAndZero{"userDefined":[{"classes":["autoNumeric-small-negative","autoNumeric-zero","autoNumeric-small-positive"]}]}The value here is not correctly displayed since callback is not displayed
You can use a custom choice for this option

rawValue:

suffixText4 choices, or your own valueOpen in the configurator

Add a text on the right hand side of the element value

This suffix text can have any characters in its string, except numeric characters and the negative or positive sign.
ChoiceValueTry itDescription
none''Default value
percentage'%'
permille'‰'
basisPoint'‱'
You can use a custom choice for this option

rawValue:

symbolWhenUnfocused4 choices, or your own valueOpen in the configurator

Defines the symbol placed as a suffix when not in focus or hovered

This suffix text can have any characters in its string, except numeric characters and the negative or positive sign.

The three options (divisorWhenUnfocused, decimalPlacesShownOnBlur & symbolWhenUnfocused) handle scaling of the input when the input is unfocused.
Note: the non-scaled value is stored and it is advised that you use the saveValueToSessionStorage option to ensure retaining the value ["divisor", "decimal places", "symbol"]
Example: With the following options set {divisorWhenUnfocused: '1000', decimalPlacesShownOnBlur: '1', symbolWhenUnfocused: ' K'}, the focused value will be '1,111.11' while on blur it will be '1.1 K'.

ChoiceValueTry itDescription
none''Default value
percentage'%'
permille'‰'
basisPoint'‱'
You can use a custom choice for this option

rawValue:

unformatOnHover2 choicesOpen in the configurator

Defines if the element value should be unformatted when the user hover his mouse over it while holding the Alt key

Unformatting there means that this removes any non-number characters and displays the rawValue instead.

The element is reformatted back before anything else if:
  • the user focus on the element by tabbing or clicking into it,
  • the user releases the Alt key, and
  • if we detect a mouseleave event.

We unformat again if while the mouse is over the element, the user hit Alt again.
ChoiceValueTry itDescription
unformattrueDefault value
doNotUnformatfalse

rawValue:

unformatOnSubmit2 choicesOpen in the configurator

When a submit event is detected in the parent form element, temporarily removes the formatting and set the rawValue in each AutoNumeric child elements

The output format is a numeric string (nnnn.nn or -nnnn.nn).
The formatted values are immediately set back after the submit event.

Not much to see here, you would have to try it in your code for now! :)

ChoiceValueTry itDescription
unformattrue
keepCurrentValuefalseDefault value

rawValue:

valuesToStrings3 choices, or your own valueOpen in the configurator

Provides a way for automatically replacing the formatted value with a pre-defined string, when the raw value is equal to a specific value

You can specify as many 'conversion' as needed.
ChoiceValueTry itDescription
nonenullDefault value
zeroDash{"0":"-"}Usually used in accounting where the zero value is replaced by an hyphen
oneAroundZero{"1":"Max","-1":"Min"}
You can use a custom choice for this option

rawValue:

watchExternalChanges2 choicesOpen in the configurator

Defines if the AutoNumeric element should watch external changes made without using .set()

This allows to be aware of changes made directly to the input value using direct access to the element.value property, like aNElement.node().value = 42.

You can try to run AutoNumeric.getElement('#watchExternalChanges input').node().value = 42 in the console and see how the AutoNumeric-managed element react

ChoiceValueTry itDescription
watchtrueAutoNumeric will format the new value using .set() internally
doNotWatchfalseAutoNumeric won't format the new value set externally, nor save it in the historyDefault value

rawValue:

wheelOn2 choicesOpen in the configurator

Defines when the wheel event will increment or decrement the element value

This options accepts two choices:
  • 'focus': will only modify the value if the element is focused, and
  • 'hover': will modify the value if the element is hovered (focused or not).

That option is linked to the modifyValueOnWheel one and will only be used if the latter is set to true

When wheelOn is set to 'focus', you can use the Shift modifier key while using the mouse wheel in order to temporarily activate the increment/decrement feature even if the element is not focused.
When wheelOn is set to 'hover', you can use the Shift modifier key while using the mouse wheel in order to temporarily disable the increment/decrement feature even if the element is not hovered.

ChoiceValueTry itDescription
focus'focus'The AutoNumeric-managed element needs to be focused for the wheel event to change the valueDefault value
hover'hover'Using the wheel event while the mouse is hovering the element is sufficient (no focus needed)

rawValue:

wheelStep1 choice, or your own valueOpen in the configurator

Defines by how much the element value should be incremented/decremented on the wheel event

This option defines the offset that can be either:
  • a fixed step value (a positive float or integer number like 1000), or
  • the 'progressive' string.
Note: A float step can be used, but as always Javascript has limitation when it comes to manipulating floats ; be careful when you do.

That option is linked to the modifyValueOnWheel one and will only be used if the latter is set to true

ChoiceValueTry itDescription
progressive'progressive'The 'progressive' mode will increment/decrement the element value based on its current value.
The bigger the number, the bigger the step, and vice versa.
Default value
You can use a custom choice for this option

rawValue: