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.
| Option | Description | Default value |
|---|---|---|
| allowDecimalPadding | Defines if the decimal places should be padded with zeroes | true |
| alwaysAllowDecimalCharacter | Defines if the decimal character or decimal character alternative should be accepted when there is already a decimal character shown in the element. | false |
| caretPositionOnFocus | Defines where should be positioned the caret on focus | null |
| createLocalList | Defines if a local list of AutoNumeric objects should be kept when initializing this object. | true |
| currencySymbol | Defines the currency symbol string. | '' |
| currencySymbolPlacement | Defines where the currency symbol should be placed (before of after the numbers) | 'p' |
| decimalCharacter | Defines what decimal separator character is used | '.' |
| decimalCharacterAlternative | Allow to declare an alternative decimal separator which is automatically replaced by `decimalCharacter` when typed | null |
| decimalPlaces | Defines the default number of decimal places to show on the formatted value, and keep for the precision | 2 |
| decimalPlacesRawValue | Defines how many decimal places should be kept for the raw value rawValue | null |
| decimalPlacesShownOnBlur | Defines how many decimal places should be visible when the element is unfocused | null |
| decimalPlacesShownOnFocus | Defines how many decimal places should be visible when the element has the focus | null |
| defaultValueOverride | Helper option for Asp.net postback | null |
| digitalGroupSpacing | Defines how many numbers should be grouped together | '3' |
| digitGroupSeparator | Defines the thousand grouping separator character | ',' |
| divisorWhenUnfocused | The number that divides the element value on focus | null |
| emptyInputBehavior | Defines what should be displayed in the element if the raw value is an empty string '' | 'focus' |
| eventBubbles | Defines if the custom and native events triggered by AutoNumeric should bubble up or not | true |
| eventIsCancelable | Defines if the custom and native events triggered by AutoNumeric should be cancelable | true |
| failOnUnknownOption | 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 | false |
| formatOnPageLoad | Determine if the default value will be formatted on initialization | true |
| formulaMode | Defines if the formula mode can be activated by the user | false |
| historySize | Set the undo/redo history table size | 20 |
| isCancellable | Allow the user to cancel and undo the changes he made to the given autonumeric-managed element, by pressing the Escape key | true |
| leadingZero | Controls the leading zero behavior | 'deny' |
| maximumValue | Defines the maximum possible value a user can enter | '10000000000000' |
| minimumValue | Defines the minimum possible value a user can enter | '-10000000000000' |
| modifyValueOnWheel | Allows the user to increment or decrement the element value with the mouse wheel | true |
| negativeBracketsTypeOnBlur | Adds brackets-like characters on negative values when unfocused | null |
| negativePositiveSignPlacement | Placement of the negative/positive sign relative to the currencySymbol option | null |
| negativeSignCharacter | Defines the negative sign symbol to use | '-' |
| noEventListeners | Defines if the element should have event listeners activated on it | false |
| onInvalidPaste | Manage how autoNumeric react when the user tries to paste an invalid number | 'error' |
| outputFormat | Defines how the value should be formatted when wanting a localized version of it | 'string' |
| overrideMinMaxLimits | Override the minimum and maximum limits | null |
| positiveSignCharacter | Defines the positive sign symbol to use | '+' |
| rawValueDivisor | Divides the formatted value shown in the AutoNumeric element and store the divided result in rawValue | null |
| readOnly | Defines if the element (<input> or another allowed html tag) should be set as read only on initialization | false |
| roundingMethod | Defines the rounding method to use | 'S' |
| saveValueToSessionStorage | Set to true to allow the decimalPlacesShownOnFocus value to be saved with sessionStorage | false |
| selectNumberOnly | Determine if the select all keyboard command will select the complete input text, or only the input numeric value | true |
| selectOnFocus | Defines if the element value should be selected on focus | true |
| serializeSpaces | Defines how the serialize functions should treat the spaces | '+' |
| showOnlyNumbersOnFocus | 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) | false |
| showPositiveSign | Allow the positive sign symbol positiveSignCharacter to be displayed for positive numbers | false |
| showWarnings | Defines if warnings should be shown in the console | true |
| styleRules | Defines the rules that calculate the CSS class(es) to apply on the element, based on the raw unformatted value | null |
| suffixText | Add a text on the right hand side of the element value | '' |
| symbolWhenUnfocused | Defines the symbol placed as a suffix when not in focus or hovered | '' |
| unformatOnHover | Defines if the element value should be unformatted when the user hover his mouse over it while holding the Alt key | true |
| unformatOnSubmit | When a submit event is detected in the parent form element, temporarily removes the formatting and set the rawValue in each AutoNumeric child elements | false |
| valuesToStrings | Provides a way for automatically replacing the formatted value with a pre-defined string, when the raw value is equal to a specific value | null |
| watchExternalChanges | Defines if the AutoNumeric element should watch external changes made without using .set() | false |
| wheelOn | Defines when the wheel event will increment or decrement the element value | 'focus' |
| wheelStep | Defines 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
'floats', padding is only done when there are some decimals.Note: setting allowDecimalPadding to false will override the decimalPlaces option
| Choice | Value | Try it | Description |
|---|---|---|---|
| always | true | Always pad decimals with zeros (ie. '12.3400')Default value | |
| never | false | Never 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.
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.| Choice | Value | Try it | Description |
|---|---|---|---|
| alwaysAllow | true | Allow entering a decimal character even if one is already present in the number | |
| doNotAllow | false | Prevent 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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 | |
| doNoForceCaretPosition | null | Do 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| createList | true | Allow the creation of the local listDefault value | |
| doNotCreateList | false | Prevent the creation of the local list |
rawValue:
currencySymbol44 choices, or your own valueOpen in the configurator
Defines the currency symbol string.
'$ ' or ' $')| Choice | Value | Try it | Description |
|---|---|---|---|
| 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)
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
',' as the decimal character and have keyboards with numeric pads providing a period '.' as the decimal character (in France or Spain for instance)| Choice | Value | Try it | Description |
|---|---|---|---|
| none | null | No 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| none | 0 | No decimal places are shown nor kept in the rawValue | |
| one | 1 | One decimal place is shown and kept in the rawValue | |
| two | 2 | Two decimal places are shown and kept in the rawValueDefault value | |
| three | 3 | Three decimal places are shown and kept in the rawValue | |
| four | 4 | Four decimal places are shown and kept in the rawValue | |
| Five | 5 | Five decimal places are shown and kept in the rawValue | |
| Six | 6 | Six 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
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.
| Choice | Value | Try it | Description |
|---|---|---|---|
| useDefault | null | This option is ignored and the decimalPlaces option value is used insteadDefault value | |
| none | 0 | No decimal places are shown nor kept in the rawValue | |
| one | 1 | One decimal place is shown and kept in the rawValue | |
| two | 2 | Two decimal places are shown and kept in the rawValue | |
| three | 3 | Three decimal places are shown and kept in the rawValue | |
| four | 4 | Four decimal places are shown and kept in the rawValue | |
| Five | 5 | Five decimal places are shown and kept in the rawValue | |
| Six | 6 | Six 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
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.| Choice | Value | Try it | Description |
|---|---|---|---|
| useDefault | null | This option is ignored and the decimalPlaces option value is used insteadDefault value | |
| none | 0 | No decimal places are shown nor kept in the rawValue | |
| one | 1 | One decimal place is shown and kept in the rawValue | |
| two | 2 | Two decimal places are shown and kept in the rawValue | |
| three | 3 | Three decimal places are shown and kept in the rawValue | |
| four | 4 | Four decimal places are shown and kept in the rawValue | |
| Five | 5 | Five decimal places are shown and kept in the rawValue | |
| Six | 6 | Six 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
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| Choice | Value | Try it | Description |
|---|---|---|---|
| useDefault | null | This option is ignored and the decimalPlaces option value is used insteadDefault value | |
| none | 0 | No decimal places are shown nor kept in the rawValue | |
| one | 1 | One decimal place is shown and kept in the rawValue | |
| two | 2 | Two decimal places are shown and kept in the rawValue | |
| three | 3 | Three decimal places are shown and kept in the rawValue | |
| four | 4 | Four decimal places are shown and kept in the rawValue | |
| Five | 5 | Five decimal places are shown and kept in the rawValue | |
| Six | 6 | Six 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
Examples:
no default
value="" {defaultValueOverride: ""}value=1234.56 {defaultValueOverride: '1234.56'}If you do not use Asp.net, you can ignore that option
| Choice | Value | Try it | Description |
|---|---|---|---|
| doNotOverride | null | Default value | |
| You can use a custom choice for this option | |||
rawValue:
digitalGroupSpacing4 choicesOpen in the configurator
Defines how many numbers should be grouped together
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
If
'.' is set, then you'll get '1.234.567'Note: the decimalCharacter and digitGroupSeparator cannot be the same character
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
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
| Choice | Value | Try it | Description |
|---|---|---|---|
| none | null | Default value | |
| percentage | 100 | ||
| permille | 1000 | ||
| basisPoint | 10000 | ||
| 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 ''
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| bubbles | true | All native and custom events will bubble upDefault value | |
| doesNotBubble | false | No 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| isCancelable | true | All native and custom events will be cancelableDefault value | |
| isNotCancelable | false | No 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
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.
| Choice | Value | Try it | Description |
|---|---|---|---|
| fail | true | ||
| ignore | false | Default value |
rawValue:
formatOnPageLoad2 choicesOpen in the configurator
Determine if the default value will be formatted on initialization
| Choice | Value | Try it | Description |
|---|---|---|---|
| format | true | Automatically formats the default value on initializationDefault value | |
| doNotFormat | false | Will not format the default value on initialization |
rawValue:
formulaMode2 choicesOpen in the configurator
Defines if the formula mode can be activated by the user
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.| Choice | Value | Try it | Description |
|---|---|---|---|
| enabled | true | Enable the formula mode | |
| disabled | false | Disable the formula modeDefault value |
rawValue:
historySize6 choices, or your own valueOpen in the configurator
Set the undo/redo history table size
rawValue as well and the last known caret position / selectionWarning: Using a large number here is not advised. The larger the number, the larger the memory used.
| Choice | Value | Try it | Description |
|---|---|---|---|
| verySmall | 5 | ||
| small | 10 | ||
| medium | 20 | Default value | |
| large | 50 | ||
| veryLarge | 100 | ||
| insane | 9007199254740991 | This 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
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
Enterto validate his entries (Enterthrows achangeevent), 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 theselectNumberOnlyoption)
| Choice | Value | Try it | Description |
|---|---|---|---|
| cancellable | true | Allows using the Escape key to cancel the last edited changesDefault value | |
| notCancellable | false | The Escape key only select the element value, without undoing any changes |
rawValue:
leadingZero3 choicesOpen in the configurator
Controls the leading zero behavior
0 on the far left of the numbers is allowed, and if the superfluous zeroes should be kept when the input is blurred| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
- 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
- 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
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.
- 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
Shiftmodifier 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| modifyValue | true | Allows using the wheel event to either increment of decrement the element valueDefault value | |
| doNothing | false | The wheel event is ignored |
rawValue:
negativeBracketsTypeOnBlur11 choicesOpen in the configurator
Adds brackets-like characters on negative values when unfocused
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.| Choice | Value | Try it | Description |
|---|---|---|---|
| parentheses | '(,)' | This notation is used in accounting in North America | |
| brackets | '[,]' | ||
| chevrons | '<,>' | ||
| curlyBraces | '{,}' | ||
| angleBrackets | '〈,〉' | ||
| japaneseQuotationMarks | '「,」' | ||
| halfBrackets | '⸤,⸥' | ||
| whiteSquareBrackets | '⟦,⟧' | ||
| quotationMarks | '‹,›' | ||
| guillemets | '«,»' | ||
| none | null | Default value |
rawValue:
negativePositiveSignPlacement5 choicesOpen in the configurator
Placement of the negative/positive sign relative to the currencySymbol option
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 ifnegativePositiveSignPlacementisnullandcurrencySymbolis not empty-1,234.56$:{currencySymbol: "$", currencySymbolPlacement: "s", negativePositiveSignPlacement: "p"}. Default ifnegativePositiveSignPlacementisnullandcurrencySymbolis not empty1,234.56-:{negativePositiveSignPlacement: "s"}$1,234.56-:{currencySymbol: "$", negativePositiveSignPlacement: "s"}1,234.56-$:{currencySymbol: "$", currencySymbolPlacement: "s"}1,234.56$-:{currencySymbol: "$", currencySymbolPlacement: "s", negativePositiveSignPlacement: "r"}
| Choice | Value | Try it | Description |
|---|---|---|---|
| prefix | 'p' | This notation is used in accounting in North America | |
| suffix | 's' | ||
| left | 'l' | ||
| right | 'r' | ||
| none | null | Default value |
rawValue:
negativeSignCharacter12 choices, or your own valueOpen in the configurator
Defines the negative sign symbol to use
string of only one character| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
<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
| Choice | Value | Try it | Description |
|---|---|---|---|
| noEvents | true | Since AutoNumeric will not monitor the user input, it's probably best to use this option in conjonction with the readOnly one | |
| addEvents | false | The 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
paste content starting with a negative sign '-' will be accepted anywhere in the input, and will set the resulting value as a negative numberNote 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.| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
'-' is translated to the custom negative sign defined in negativeSignCharacter| Choice | Value | Try it | Description |
|---|---|---|---|
| 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- | |
| none | null | nnnn.nn or -nnnn.nn as text type |
rawValue:
overrideMinMaxLimits5 choicesOpen in the configurator
Override the minimum and maximum limits
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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. | |
| doNotOverride | null | The 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
string of only one character.This is shown only if
showPositiveSign is set to true.| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
{ 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| none | null | Default value | |
| percentage | 100 | ||
| permille | 1000 | ||
| basisPoint | 10000 | ||
| 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
true, then:- the
readonlyhtml property is added to the<input>element on initialization, or - the
contenteditableattribute is set tofalseon non-input elements.
| Choice | Value | Try it | Description |
|---|---|---|---|
| readOnly | true | ||
| readWrite | false | Default value |
rawValue:
roundingMethod13 choicesOpen in the configurator
Defines the rounding method to use
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| save | true | If IE 6 or 7 are detected, the value will be saved as a session cookie | |
| doNotSave | false | Default 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
Ctrl + a or ⌘ + a.| Choice | Value | Try it | Description |
|---|---|---|---|
| selectNumbersOnly | true | Only the numbers and the negative/positive sign are selectedDefault value | |
| selectAll | false | Everything 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
selectNumberOnly option.| Choice | Value | Try it | Description |
|---|---|---|---|
| select | true | Default value | |
| doNotSelect | false | On 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
' ' 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).| Choice | Value | Try it | Description |
|---|---|---|---|
| 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)
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.| Choice | Value | Try it | Description |
|---|---|---|---|
| onlyNumbers | true | ||
| showAll | false | Default value |
rawValue:
showPositiveSign2 choicesOpen in the configurator
Allow the positive sign symbol positiveSignCharacter to be displayed for positive numbers
negativePositiveSignPlacement option, mimicking the negative sign placement rules.| Choice | Value | Try it | Description |
|---|---|---|---|
| show | true | ||
| hide | false | Default value |
rawValue:
showWarnings2 choicesOpen in the configurator
Defines if warnings should be shown in the console
Not much to see here, you would have to check the console for warning messages in your code
| Choice | Value | Try it | Description |
|---|---|---|---|
| show | true | Default value | |
| hide | false |
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
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.
| Choice | Value | Try it | Description |
|---|---|---|---|
| none | null | Default 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
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'.
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
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
Altkey, and - if we detect a
mouseleaveevent.
We unformat again if while the mouse is over the element, the user hit
Alt again.| Choice | Value | Try it | Description |
|---|---|---|---|
| unformat | true | Default value | |
| doNotUnformat | false |
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
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! :)
| Choice | Value | Try it | Description |
|---|---|---|---|
| unformat | true | ||
| keepCurrentValue | false | Default 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
| Choice | Value | Try it | Description |
|---|---|---|---|
| none | null | Default 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()
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
| Choice | Value | Try it | Description |
|---|---|---|---|
| watch | true | AutoNumeric will format the new value using .set() internally | |
| doNotWatch | false | AutoNumeric 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
'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.
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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
- a fixed step value (a positive float or integer number like
1000), or - the
'progressive'string.
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
| Choice | Value | Try it | Description |
|---|---|---|---|
| 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: