Options
All
  • Public
  • Public/Protected
  • All
Menu

The class constructor function is the exported object from the file

Hierarchy

  • export=

Index

Constructors

  • Enables the AutoNumeric feature for the given element.

    The DOM element must be one of the allowed elements. Allowed elements are <input>, as well as some other text-containing elements such <div>. See the documentation for the full list.

    When not an input element, the element may have the contenteditable set. If it does, all entered values are formatted according to the given options. Otherwise, the formatted value is set once and no further edits are possible.

    Parameters

    • element: string | HTMLElement

      Either one of the allowed elements, or a CSS selector string for a single element.

    • Optional initialValue: null | string | number

      Initial value, when null, the value of the DOM element is used.

    • Optional options: null | string | export=.CallbackOptions | (string | export=.CallbackOptions)[]

      Settings for AutoNumeric.

    Returns export=

  • Enables the AutoNumeric feature for the given element.

    The DOM element must be one of the allowed elements. Allowed elements are <input>, as well as some other text-containing elements such <div>. See the documentation for the full list.

    When not an input element, the element may have the contenteditable set. If it does, all entered values are formatted according to the given options. Otherwise, the formatted value is set once and no further edits are possible.

    Parameters

    Returns export=

Properties

Whenever init is used to initialize other DOM elements, a shared local init list of those elements is stored in the AutoNumeric instances.

This allows for neat things like modifying all those linked AutoNumeric elements globally, with only one call.

Use this property to access the handler that provides methods to modify all linked elements.

Contains convenience methods to update individual options, and also allows the options to be reset.

Methods

  • Attach the given AutoNumeric element to the shared local init list.

    When doing that, by default the DOM content is left untouched.

    The user can force a reformat with the new shared list options by passing a second argument to true.

    Parameters

    • otherAnElement: export=

      Element to attach.

    • Optional reFormat: boolean

      Whether to reformat the value after the element was attached. Defaults to true.

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the Brazilian pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the British pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the Chinese pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • clear(forceClearAll?: boolean): export=
  • Reset the element value either to the empty string '', or the currency sign, depending on the emptyInputBehavior option value. If you set the forceClearAll argument to true, then the emptyInputBehavior option is overridden and the whole input is cleared, including any currency sign.

    Parameters

    • Optional forceClearAll: boolean

      true to clear the the entire input, including the currency sign.

    Returns export=

    This instance for chaining method calls.

  • Detach the current AutoNumeric element from the shared local init list.

    This means any changes made on that local shared list will not be transmitted to that element anymore.

    Note: The user can provide another AutoNumeric element, and detach this one instead of the current one.

    Parameters

    • Optional otherAnElement: null | export=

      Element to detach.

    Returns export=

    This instance for chaining method calls.

  • form(forceSearch?: boolean): null | HTMLFormElement
  • Return a reference to the parent

    element if it exists, otherwise return null.

    If the parent form element as already been found, this directly return a reference to it.

    However, you can force AutoNumeric to search again for its reference by passing true as a parameter to this method.

    This method updates the this.parentForm attribute.

    In either case, whenever a new parent form is set for the current AutoNumeric element, we make sure to update the anCount and anFormHandler attributes on both the old form and the new one (for instance in case the user moved the input elements with appendChild() since AutoNumeric cannot not detect that).

    Parameters

    • Optional forceSearch: boolean

      Whether to force a new search for the parent <form> element, discarding any previously found one. Defaults to false.

    Returns null | HTMLFormElement

    The form element containing this AutoNumeric element, if any.

  • Return an array containing an object for each form element. The name of each pair is the name of the DOM elements. The value is is formatted value of each AutoNumeric input.

    Returns export=.NameValuePair<string>[]

    The formatted values.

  • Return an array containing an object for each form element. The name of each pair is the name of the DOM elements.

    The value is is localized value of each AutoNumeric input.

    Values might be a string or a number, depending on the outputFormat option.

    Parameters

    • Optional forcedOutputFormat: export=.OutputFormatOption

      If set to something different from null, then this is used as an override for the outputFormat option

    Returns export=.NameValuePair<string | number>[]

    The localized values.

  • Return an array containing an object for each form element. The name of each pair is the name of the DOM elements. The value is is stringified numeric value of each AutoNumeric input.

    Returns export=.NameValuePair<string | number>[]

    The numerical values.

  • formFormatted(): string
  • Return a string in standard URL-encoded notation with the form input values being formatted.

    Returns string

    The formatted string.

  • formJsonFormatted(): string
  • Return an array containing an object for each form element, stringified as a JSON string. The name of each pair is the name of the DOM elements. The value is is formatted value of each AutoNumeric input.

    Returns string

    The formatted values.

  • Return an array containing an object for each form element, stringified as a JSON string. The name of each pair is the name of the DOM elements. The value is is localized value of each AutoNumeric input.

    Parameters

    • Optional forcedOutputFormat: export=.OutputFormatOption

      If set to something different from null, then this is used as an override for the outputFormat option.

    Returns string

    The localized values.

  • formJsonNumericString(): string
  • Return an array containing an object for each form element, stringified as a JSON string. The name of each pair is the name of the DOM elements. The value is is localized value of each AutoNumeric input.

    Returns string

    The numerical values.

  • Return a string in standard URL-encoded notation with the form input values, with localized values.

    The default output format can be overridden by passing the option as a parameter.

    Parameters

    • Optional forcedOutputFormat: export=.OutputFormatOption

      If set to something different from null, then this is used as an override for the outputFormat option

    Returns string

    The localized string.

  • formNumericString(): string
  • Return a string in standard URL-encoded notation with the form input values being unformatted.

    This string can be used as a query for instance.

    Returns string

    The formatted string.

  • Reformat all the autoNumeric-managed elements that are a child of the parent element of this DOM element

    Returns export=

    This instance for chaining method calls.

  • Generate an array of the current formatted values from the <input> elements, and pass it to the given callback. Under the hood, the array is generated via a call to formArrayFormatted().

    Parameters

    Returns export=

    This instance for chaining method calls.

  • Generate an array of localized strings from the <input> elements, and pass it to the given callback.

    Under the hood, the array is generated via a call to formArrayLocalized().

    Values might be a string or a number, depending on the outputFormat option.

    Parameters

    Returns export=

    This instance for chaining method calls.

  • Generate an array of numeric strings from the <input> elements, and pass it to the given callback. Under the hood, the array is generated via a call to formArrayNumericString().

    Parameters

    Returns export=

    This instance for chaining method calls.

  • formSubmitJsonFormatted(callback: ((values: string) => void)): export=
  • Generate a JSON string with the current formatted values from the <input> elements, and pass it to the given callback. Under the hood, the array is generated via a call to formJsonFormatted().

    Parameters

    • callback: ((values: string) => void)

      Callback to invoke with the values.

        • (values: string): void
        • Parameters

          • values: string

          Returns void

    Returns export=

    This instance for chaining method calls.

  • formSubmitJsonLocalized(callback: ((values: string) => void), forcedOutputFormat?: null | string): export=
  • Generate a JSON string with the localized strings values from the <input> elements, and pass it to the given callback. Under the hood, the array is generated via a call to formJsonLocalized().

    Parameters

    • callback: ((values: string) => void)

      Callback to invoke with the values.

        • (values: string): void
        • Parameters

          • values: string

          Returns void

    • Optional forcedOutputFormat: null | string

      If set to something different from null, then this is used as an override for the outputFormat option.

    Returns export=

    This instance for chaining method calls.

  • formSubmitJsonNumericString(callback: ((values: string) => void)): export=
  • Generate a JSON string with the numeric strings values from the <input> elements, and pass it to the given callback. Under the hood, the array is generated via a call to formJsonNumericString().

    Parameters

    • callback: ((values: string) => void)

      Callback to invoke with the values.

        • (values: string): void
        • Parameters

          • values: string

          Returns void

    Returns export=

    This instance for chaining method calls.

  • Unformat all the autoNumeric-managed elements that are a child of the parent element of this DOM element, to numeric strings

    Returns export=

    This instance for chaining method calls.

  • Unformat all the autoNumeric-managed elements that are a child of the parent <form> element of this DOM element, to localized strings

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the French pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • Return the current formatted value of the AutoNumeric element as a string.

    Parameters

    • Optional callback: null | export=.GetValueCallback<string>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns string

    The formatted value.

  • 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: export=.OutputFormatOption

      Override for the outputFormat option.

    • Optional callback: null | export=.GetValueCallback<string | number>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns string | number

    The localized value.

  • 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

    • callback: export=.GetValueCallback<string | number>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns string | number

    The localized value.

  • Return the element unformatted value as a real JavaScript number.

    Parameters

    • Optional callback: null | export=.GetValueCallback<null | number>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns null | number

    The number value.

  • Return the unformatted value as a string. This can also return null if rawValue is null.

    Parameters

    • Optional callback: null | export=.GetValueCallback<null | string>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns null | string

    The numerical value.

  • Returns the options object containing all the current autoNumeric settings in effect. You can then directly access each option by using its name:

    anElement.getSettings().optionNameAutoCompleted

    Returns Required<export=.Options>

    The current settings for this instance.

  • init(domElement: HTMLElement, attached?: boolean): export=
  • init(domElement: string | HTMLElement[], attached?: boolean): export=[]
  • Use the current AutoNumeric element settings to initialize the DOM element(s) given as a parameter.

    Doing so will link the AutoNumeric elements together since they will share the same local AutoNumeric element list.

    (cf. prototype pattern : https://en.wikipedia.org/wiki/Prototype_pattern)

    You can init either a single DOM element (in that case an AutoNumeric object will be returned), or an array of DOM elements or a string that will be used as a CSS selector. In the latter cases, an array of AutoNumeric objects will then be returned (or an empty array if nothing gets selected by the CSS selector).

    Use case : Once you have an AutoNumeric element already setup correctly with the right options, you can use it as many times you want to initialize as many other DOM elements as needed.

    Note: this works only on elements that can be managed by autoNumeric.

    Parameters

    • domElement: HTMLElement

      A single element to initialize.

    • Optional attached: boolean

      If set to false, then the newly generated AutoNumeric element will not share the same local element list.

    Returns export=

    The initialized AutoNumeric instance.

  • Use the current AutoNumeric element settings to initialize the DOM element(s) given as a parameter.

    Doing so will link the AutoNumeric elements together since they will share the same local AutoNumeric element list.

    (cf. prototype pattern : https://en.wikipedia.org/wiki/Prototype_pattern)

    You can init either a single DOM element (in that case an AutoNumeric object will be returned), or an array of DOM elements or a string that will be used as a CSS selector. In the latter cases, an array of AutoNumeric objects will then be returned (or an empty array if nothing gets selected by the CSS selector).

    Use case : Once you have an AutoNumeric element already setup correctly with the right options, you can use it as many times you want to initialize as many other DOM elements as needed.

    Note: this works only on elements that can be managed by autoNumeric.

    Parameters

    • domElement: string | HTMLElement[]

      A list of elements, or a string representing a CSS selector.

    • Optional attached: boolean

      If set to false, then the newly generated AutoNumeric element will not share the same local element list.

    Returns export=[]

    The initialized AutoNumeric instances.

  • isPristine(checkOnlyRawValue?: boolean): boolean
  • Return true if all the autoNumeric-managed elements are pristine, if their raw value hasn't changed.

    By default, this returns true if the raw unformatted value is still the same even if the formatted one has changed (due to a configuration update for instance).

    Parameters

    • Optional checkOnlyRawValue: boolean

      If set to true, the pristine value is done on the raw unformatted value, not the formatted one. If set to false, this also checks that the formatted value hasn't changed.

    Returns boolean

    If this instance is pristine.

  • Update the settings to use the Japanese pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • node(): HTMLElement
  • Return the DOM element reference of the autoNumeric-managed element. The exact type depends on the element that on which AutoNumeric was initialized - AutoNumeric supports input elements as well as other content editable elements such as div elements.

    Returns HTMLElement

  • Update the settings to use the North American pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

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

    Returns void

  • parent(): HTMLElement
  • Return the DOM element reference of the parent node of the AutoNumeric managed element

    Returns HTMLElement

    The parent of the AutoNumeric element.

  • Force each element of the local AutoNumeric element list to reformat its value

    Returns export=

    This instance for chaining method calls.

  • 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 the formatted element content, based on the selectNumberOnly option

    Returns export=

    This instance for chaining method calls.

  • Select only the decimal part in the formatted element content, whatever the value of selectNumberOnly Multiple cases are possible:

    • +1.234,57suffixText
    • € +1.234,57suffixText
    • +€ 1.234,57suffixText
    • € 1.234,57+suffixText
    • 1.234,57+ €suffixText
    • 1.234,57 €+suffixText
    • +1.234,57 €suffixText

    Returns export=

    This instance for chaining method calls.

  • Select only the integer part in the formatted element content, whatever the value of selectNumberOnly

    Returns export=

    This instance for chaining method calls.

  • Select only the numbers in the formatted element content, leaving out the currency symbol, whatever the value of the selectNumberOnly option

    Returns export=

    This instance for chaining method calls.

  • 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

    Parameters

    • newValue: null | string | number

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

    • Optional options: export=.CallbackOptions

      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 export=

    This instance for chaining method calls.

  • 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: null | string | number

      New value to set.

    • Optional options: export=.CallbackOptions

      New options to set.

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the Spanish pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • Update the settings to use the Swiss pre-defined language options. Those pre-defined options can be overridden by passing an option object as a parameter.

    Parameters

    • Optional optionOverride: null | export=.CallbackOptions

      Optional options to override the pre-defined options.

    Returns export=

    This instance for chaining method calls.

  • Remove the formatting and keep only the raw unformatted value (as a numericString) in each element of the local AutoNumeric element list

    Returns export=

    This instance for chaining method calls.

  • Remove the formatting and keep only the localized unformatted value in the element, with the option to override the default outputFormat if needed

    Parameters

    • Optional forcedOutputFormat: export=.OutputFormatOption

      If set to something different from null, then this is used as an overriding outputFormat option

    Returns export=

    This instance for chaining method calls.

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

    Parameters

    • Rest ...options: export=.CallbackOptions[]

      New options to set. When multiple options are specified, later options override previous options.

    Returns export=

    This instance for chaining method calls.

  • 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

  • Return true in the settings are valid

    Parameters

    Returns boolean

  • format(value: string | number | HTMLElement, ...options: export=.Options[]): string
  • Format the given number with the given options. This returns the formatted value as a string.

    Parameters

    • value: string | number | HTMLElement
    • Rest ...options: export=.Options[]

      Options to use instead of the default options.

    Returns string

    The formatted string.

  • formatAndSet(domElement: HTMLElement, options?: null | export=.Options): string
  • Format the value of the DOM element with the given options and returns the formatted value as a string.

    Parameters

    • domElement: HTMLElement

      An element with a value to format.

    • Optional options: null | export=.Options

      Options to use instead of the default options.

    Returns string

    The formatted string.

  • getAutoNumericElement(domElement: HTMLElement): export=
  • Return the AutoNumeric object that manages the given DOM element

    Parameters

    • domElement: HTMLElement

    Returns export=

  • Return the default AutoNumeric settings

    Returns Required<export=.Options>

  • getLocalized(value: string | HTMLElement, forcedOutputFormat?: export=.OutputFormatOption, callback?: null | ((value: string | number) => void)): string | number
  • getLocalized(value: string | HTMLElement, callback: ((value: string | number) => void)): string | number
  • Returns the unformatted value following the outputFormat setting, from the given DOM element or query selector.

    See the non-static getLocalized method documentation for more details.

    Parameters

    • value: string | HTMLElement

      A string to localize, or a DOM element with a value to localize.

    • Optional forcedOutputFormat: export=.OutputFormatOption

      Override for the outputFormat option.

    • Optional callback: null | ((value: string | number) => void)

      Callback to invoke with the localized value.

    Returns string | number

    The localized value.

  • Returns the unformatted value following the outputFormat setting, from the given DOM element or query selector.

    See the non-static getLocalized method documentation for more details.

    Parameters

    • value: string | HTMLElement

      A string to localize, or a DOM element with a value to localize.

    • callback: ((value: string | number) => void)

      Callback to invoke with the localized value.

        • (value: string | number): void
        • Parameters

          • value: string | number

          Returns void

    Returns string | number

    The localized value.

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

    Parameters

    • domElement: HTMLElement

    Returns boolean

  • localize(value: string | number | HTMLElement, options?: null | export=.Options): string | number
  • Unformats and localizes the given formatted string with the given options.

    This basically allows to get the localized value without first having to initialize an AutoNumeric object.

    The returned value may be either a string or a number, depending on the outputFormat option.

    Parameters

    • value: string | number | HTMLElement

      A string to unformat and localize, or an input element with a value to unformat and localize.

    • Optional options: null | export=.Options

      Optional options to use instead of the current options of this instance.

    Returns string | number

    The localized value.

  • localizeAndSet(domElement: HTMLElement, options?: null | export=.Options): string | number
  • Unformats and localizes the value of the given element with the given options, then sets the localized value on the element.

    This basically allows to set the localized value without first having to initialize an AutoNumeric object.

    The returned value may be either a string or a number, depending on the outputFormat option.

    Parameters

    • domElement: HTMLElement
    • Optional options: null | export=.Options

      Optional options to use instead of the current options of this instance.

    Returns string | number

    The localized value.

  • Merge the current options with the given list of options.

    If a string is given, then we try to get the related pre-defined option using that string as its name.

    When merging the options, the latest option overwrite any previously set. This allows to fine tune a pre-defined option for instance.

    Parameters

    Returns export=.Options

    The merged options.

  • Enables the AutoNumeric feature for the given elements.

    The DOM element must be one of the allowed elements. Allowed elements are <input>, as well as some other text-containing elements such <div>. See the documentation for the full list.

    When not an input element, the element may have the contenteditable set. If it does, all entered values are formatted according to the given options. Otherwise, the formatted value is set once and no further edits are possible.

    Parameters

    • elements: string | HTMLElement[] | { exclude?: HTMLInputElement[]; rootElement: HTMLElement }

      A list of elements, which may be a CSS selector string.

    • Optional initialValue: null | string | number | (null | string | number)[]

      Initial value to set. Can be an array to set a different value for each element. When null, the value of the DOM element is used.

    • Optional options: null | string | export=.CallbackOptions | (string | export=.CallbackOptions)[]

      AutoNumeric options. Can be an array to use a different set of options for each element.

    Returns export=[]

  • Enables the AutoNumeric feature for the given elements.

    The DOM element must be one of the allowed elements. Allowed elements are <input>, as well as some other text-containing elements such <div>. See the documentation for the full list.

    When not an input element, the element may have the contenteditable set. If it does, all entered values are formatted according to the given options. Otherwise, the formatted value is set once and no further edits are possible.

    Parameters

    • elements: string | HTMLElement[] | { exclude?: HTMLInputElement[]; rootElement: HTMLElement }

      A list of elements, which may be a CSS selector string.

    • options: export=.CallbackOptions | (string | export=.CallbackOptions)[]

      AutoNumeric options. Can be an array to use a different set of options for each element.

    Returns export=[]

  • set(element: string | HTMLElement, newValue: null | string | number, options?: null | export=.CallbackOptions, saveChangeToHistory?: boolean): null | export=
  • Set the given value on the AutoNumeric object that manages the given DOM element, if any.

    Parameters

    • element: string | HTMLElement

      DOM element with a value to unformat and set. Can be a CSS selector string.

    • newValue: null | string | number

      The new value to set. Can be null when emptyInputBehavior is set to null.

    • Optional options: null | export=.CallbackOptions

      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. Defaults to true.

    Returns null | export=

    The AutoNumeric instance of the given element, or null if no such instance was found.

  • test(domElement: string | HTMLElement): boolean
  • Test if the given DOM element, or the element selected by the given selector string is already managed by AutoNumeric (if it has been initialized on the current page).

    Parameters

    • domElement: string | HTMLElement

    Returns boolean

    Whether the element is managed by AutoNumeric.

  • unformat(value: string | number | HTMLElement, ...options: export=.Options[]): string | number
  • Unformats the given formatted string with the given options. This returns a numeric string.

    It can also unformat the given DOM element value with the given options and returns the unformatted numeric string.

    Note: This does not update that element value.

    This basically allows to get the unformatted value without first having to initialize an AutoNumeric object.

    The returned value might be a string or a number, depending on the outputFormat option.

    Parameters

    • value: string | number | HTMLElement

      A number, or a string that represent a JavaScript number, or a DOM element with a value.

    • Rest ...options: export=.Options[]

      Optional to use instead of the default options.

    Returns string | number

    The unformatted value.

  • unformatAndSet(value: HTMLElement, options?: null | export=.Options): string | number
  • Unformats the given DOM element value, and set the resulting value back as the element value.

    The returned value might be a string or a number, depending on the outputFormat option.

    Parameters

    • value: HTMLElement
    • Optional options: null | export=.Options

      Optional to use instead of the default options.

    Returns string | number

    The unformatted value.

  • Validate the given option object.

    If the options are valid, this function returns nothing, otherwise if the options are invalid, this function throws an error.

    This tests if the options are not conflicting and are well formatted.

    This function is lenient since it only tests the settings properties ; it ignores any other properties the options object could have.

    throws

    If the given options are not valid.

    Parameters

    • options: export=.Options

      Options to validate.

    • Optional shouldExtendDefaultOptions: boolean

      If true, then this function will extend the userOptions passed by the user, with the default options.

    • Optional originalOptions: null | export=.Options

      The user can pass the original options (and not the one that are generated from the default settings and the various usability corrections), in order to add compatibility and conflicts checks.

    Returns void

  • version(): string
  • Returns the AutoNumeric version number (for debugging purpose).

    Returns string

    The current AutoNumeric version.

Generated using TypeDoc