onChange([callback], [remove])

Class: Spinner. Method inherited from UIComponent.

Description:

Gets, registers or unregisters a handler function for component's text value change event. Applied to components where text can be changed by user, such as TextField, PasswordField, TextArea, DocumentEditor, ComboBox, Spinner, etc.

Parameters:

Name Type Default Description

[callback]

function

The event handler function that receives a ChangeEvent object. Pass null to unregister all handler functions.

[remove]

boolean

false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: this | Array.<function()>

Examples:

// Example event object:
const e = {
  target: object,   // The component that triggered the event.
  type: string,     // `change`, `changing`.
                    // change - when value has changed and there is no prediction that it is still being changed by user.
                    // changing - when the value is still being changed, for example Slider object's knob is still being moved by user. Present when applicable.
  action: string,   // `inserted`, `removed`. Present for some text editing components. Indicates an action performed with text.
  position: number, // Indicates position at which text was inserted. Present when e.action is present.
  length: number    // Indicates amount of characters inserted or removed. Present when e.action is present.
};

Also See: