Options that may be passed to autoNumeric during initialization. You can initialize autoNumeric by selecting an input element and calling the autoNumeric function. You can pass an options object to that function call:

$("[data-name='tfMoney']").autoNumeric(options);

The available options are documented below.

Please note that instead of specifying the options via JavaScript, you can also add HTML data attributes to the input field:

<input id="money-field"
    data-a-dec=","
    data-a-sign="kg"
    data-v-min="1"
    data-v-max="100"
    data-m-dec="3"
>

Hierarchy

  • InitOptions

Index

Properties

aDec

aDec: string

Controls the decimal character. Default is a period (.).

aForm

aForm: boolean

Controls if default (initial) values are formatted on page ready (load).

  • true: Initial values are formatted on page ready (this is the default behavior)
  • false: Initial values are not formatted on page ready. Formatting starts once the user starts typing.

aPad

aPad: boolean

Controls padding of the decimal places. true: always pads the decimal with zeros (default) false: no padding

aSep

aSep: string

Controls the thousand separator character. Default is comma (,).

aSign

aSign: string

Displays the desired currency or unit symbol (examples: or EUR). Default is undefined.

If not set, no unit symbol is shown.

altDec

altDec: string

This was developed to accommodate for different keyboard layouts. altDec allows you to declare an alternative key to enter the decimal separator assigned in aDec

dGroup

dGroup: GroupMode

Controls the digital grouping and the placement of the thousand separator, eg.

  • 2: Groups of hundreds, eg. 13,24,98
  • 3: Groups of thousands, eg. 132,498 (default)
  • 4: Groups of ten-thousands, eg. 13,2498

lZero

lZero: ZeroMode

Controls leading zeros behavior.

  • allow: Allows leading zero to be entered. They are removed on focusout event (default).
  • deny: Leading zeros not allowed.
  • keep: Leading zeros allowed and will be retained on the focusout event.

mDec

mDec: number

Overrides the decimal places that that are set via the vMin / vMax settings. Default is undefined.

mRound

mRound: RoundMode

Sets the rounding method used. Available methods are:

  • S: Round-Half-Up Symmetric (default)
  • A: Round-Half-Up Asymmetric
  • s: Round-Half-Down Symmetric
  • a: Round-Half-Down Asymmetric
  • B: Round-Half-Even "Bankers Rounding"
  • U: Round Up "Round-Away-From-Zero"
  • D: Round Down "Round-Toward-Zero" - same as truncate
  • C: Round to Ceiling "Toward Positive Infinity"
  • F: Round to Floor "Toward Negative Infinity"
  • CHF: Rounding for Swiss currency "to the nearest .00 or .05"

nBracket

nBracket: BracketMode

Controls if negative values are displayed with brackets when the input does not have focus. Default is undefined.

pSign

pSign: SignMode

Controls the placement of the currency or unit symbol (prefix or suffix).

  • p: prefix to the left (default).
  • s: suffix to the right.

vMax

vMax: number

Controls the maximum allowed value. Default is 9999999999999.99.

vMin

vMin: number

Controls the minimum allowed value. Default is -9999999999999.99.

wEmpty

wEmpty: EmptyMode

Controls input display behavior.

  • empty: Allows input to be empty (default)
  • zero: Input field will have at least a zero value.
  • sign: The currency symbol is always present.