Options
All
  • Public
  • Public/Protected
  • All
Menu

The class constructor function is the exported object from the file

Hierarchy

  • export=

Index

Constructors

constructor

  • new export=(elementOrSelector: string | HTMLElement | HTMLInputElement, initialValue?: null | string | number, options?: null | string | Options): export=
  • Parameters

    • elementOrSelector: string | HTMLElement | HTMLInputElement
    • Optional initialValue: null | string | number
    • Optional options: null | string | Options

    Returns export=

Methods

attach

  • attach(otherAnElement: HTMLElement, reFormat?: boolean): void
  • Parameters

    Returns void

clear

  • clear(reset?: boolean): void
  • Parameters

    • Optional reset: boolean

    Returns void

detach

  • detach(): void
  • Returns void

form

  • form(forcedSearch?: boolean): HTMLFormElement
  • Parameters

    • Optional forcedSearch: boolean

    Returns HTMLFormElement

formArrayFormatted

  • formArrayFormatted(): HTMLInputElement[]
  • Returns HTMLInputElement[]

formArrayLocalized

  • formArrayLocalized(): HTMLInputElement[]
  • Returns HTMLInputElement[]

formArrayNumericString

  • formArrayNumericString(): HTMLInputElement[]
  • Returns HTMLInputElement[]

formFormatted

  • formFormatted(): string
  • Returns string

formJsonFormatted

  • formJsonFormatted(): string
  • Returns string

formJsonLocalized

  • formJsonLocalized(): string
  • Returns string

formJsonNumericString

  • formJsonNumericString(): string
  • Returns string

formLocalized

formNumericString

  • formNumericString(): string
  • Returns string

formReformat

  • formReformat(): void
  • Returns void

formSubmitArrayFormatted

  • formSubmitArrayFormatted(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formSubmitArrayLocalized

  • formSubmitArrayLocalized(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formSubmitArrayNumericString

  • formSubmitArrayNumericString(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formSubmitJsonFormatted

  • formSubmitJsonFormatted(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formSubmitJsonLocalized

  • formSubmitJsonLocalized(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formSubmitJsonNumericString

  • formSubmitJsonNumericString(callback: Function): export=
  • Parameters

    • callback: Function

    Returns export=

formUnformat

  • formUnformat(): void
  • Returns void

getFormatted

  • getFormatted(callback?: (value: string, instance: export=) => void): string
  • Return the current formatted value of the AutoNumeric element as a string.

    Parameters

    • Optional callback: (value: string, instance: export=) => void
        • (value: string, instance: export=): void
        • Parameters

          Returns void

    Returns string

getLocalized

  • getLocalized(forcedOutputFormat?: OutputFormatOption, callback?: (value: string) => void): string
  • getLocalized(callback: (value: string) => void): string
  • Returns the unformatted value, but following the outputFormat setting, which means the output can either be:

    • a string (that could or could not represent a number, ie. "12345,67-"), or
    • a plain number (if the setting 'number' is used).

    By default the returned values are an ISO numeric string "1234.56" or "-1234.56" where the decimal character is a period. Check the outputFormat option definition for more details.

    Parameters

    • Optional forcedOutputFormat: OutputFormatOption
    • Optional callback: (value: string) => void
        • (value: string): void
        • Parameters

          • value: string

          Returns void

    Returns string

  • Parameters

    • callback: (value: string) => void
        • (value: string): void
        • Parameters

          • value: string

          Returns void

    Returns string

getNumber

  • getNumber(callback?: (value: null | number, instance: export=) => null | void): null | number
  • Return the element unformatted value as a real JavaScript number.

    Parameters

    • Optional callback: (value: null | number, instance: export=) => null | void
        • (value: null | number, instance: export=): null | void
        • Parameters

          • value: null | number
          • instance: export=

          Returns null | void

    Returns null | number

getNumericString

  • getNumericString(callback?: (value: null | string, instance: export=) => null | void): null | string
  • Return the unformatted value as a string. This can also return null if rawValue is null.

    Parameters

    • Optional callback: (value: null | string, instance: export=) => null | void
        • (value: null | string, instance: export=): null | void
        • Parameters

          • value: null | string
          • instance: export=

          Returns null | void

    Returns null | string

init

isPristine

  • isPristine(): boolean
  • Returns boolean

node

  • node(): HTMLInputElement
  • Return the DOM element reference of the autoNumeric-managed element

    Returns HTMLInputElement

nuke

  • nuke(): void
  • Remove the autoNumeric data and event listeners from the element, and delete the DOM element altogether

    Returns void

parent

reformat

  • reformat(): void
  • Returns void

remove

  • remove(): void
  • Remove the autoNumeric data and event listeners from the element, but keep the element content intact. This also clears the value from sessionStorage (or cookie, depending on browser supports). Note: this does not remove the formatting.

    Returns void

select

  • select(): void
  • Returns void

selectDecimal

  • selectDecimal(): void
  • Returns void

selectInteger

  • selectInteger(): void
  • Returns void

selectNumber

  • selectNumber(): void
  • Returns void

set

  • set(newValue: null | string | number, options?: Options, saveChangeToHistory?: boolean): void
  • Set the given element value, and format it immediately. Additionally, this set() method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.

    example

    anElement.set('12345.67') // Formats the value

    example

    anElement.set(12345.67) // Formats the value

    example

    anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go

    example

    anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not exactly respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)

    example

    anElement.set(null) // Set the rawValue and element value to null

    throws

    Parameters

    • newValue: null | string | number

      The value must be a Number, a numeric string or null (if emptyInputBehavior is set to 'null')

    • Optional options: Options

      A settings object that will override the current settings. Note: the update is done only if the newValue is defined.

    • Optional saveChangeToHistory: boolean

      If set to true, then the change is recorded in the history table

    Returns void

setUnformatted

  • setUnformatted(value: number, options?: Options): void
  • Set the given value directly as the DOM element value, without formatting it beforehand. You can also set the value and update the setting in one go (the value will again not be formatted immediately).

    Parameters

    • value: number
    • Optional options: Options

    Returns void

unformat

  • unformat(): void
  • Returns void

unformatLocalized

update

  • Updates the AutoNumeric settings, and immediately format the element accordingly.

    Parameters

    Returns export=

wipe

  • wipe(): void
  • Remove the autoNumeric data and event listeners from the element, and reset its value to the empty string ''. This also clears the value from sessionStorage (or cookie, depending on browser supports).

    Returns void

Static areSettingsValid

  • areSettingsValid(options: Options): boolean
  • Return true in the settings are valid

    Parameters

    Returns boolean

Static format

  • Format the given number with the given options. This returns the formatted value as a string.

    Parameters

    Returns string

Static formatAndSet

  • Format the domElement value with the given options and returns the formatted value as a string.

    Parameters

    Returns string

Static getAutoNumericElement

  • Return the AutoNumeric object that manages the given DOM element

    Parameters

    Returns export=

Static getDefaultConfig

  • Return the default autoNumeric settings

    Returns Options

Static getPredefinedOptions

Static isManagedByAutoNumeric

  • isManagedByAutoNumeric(domElement: HTMLElement): boolean
  • Return true if the given DOM element has an AutoNumeric object that manages it.

    Parameters

    Returns boolean

Static localize

  • Unformat and localize the given formatted string with the given options.

    Parameters

    Returns string

Static localizeAndSet

Static mergeOptions

Static multiple

  • Parameters

    • elementsOrSelector: string | HTMLElement[] | { exclude?: HTMLInputElement[]; rootElement: HTMLElement }
    • Optional initialValue: null | number | (null | number)[]
    • Optional options: null | Options | Options[]

    Returns export=[]

Static reformatAndSet

  • reformatAndSet(referenceToTheDomElement: HTMLElement): void
  • Parameters

    Returns void

Static test

Static validate

  • validate(options: Options): boolean
  • Parameters

    Returns boolean

Static version

  • version(): string
  • Returns string

Generated using TypeDoc