Home Reference Source
import {Input} from 'newton-lib/src/dom/dom.js'
public class | source

Input

Extends:

DOMElement → Input

Class used to handle an Input (<input>).

Example:

// Given the following HTML input element:
//   <input id="value"></button>
var value = new Input("value", function(val) {
 console.log(val);
});

Constructor Summary

Public Constructor
public

constructor(id: string, onChange: function)

Member Summary

Public Members
public

Default value for the input.

public

Flag for remembering if the input is invalid.

public

Defines if the parsed value must be casted to a number, otherwise the input is invalid.

public

Callback function for when the input value changes.

public

Callback function for when the focus is lost.

public

Stores the parsed value of the input.

Method Summary

Public Methods
public

invalid(state: *)

public

set(value: *)

Inherited Summary

From class DOMElement
public

Stores if the element is enabled or disabled.

public

jQuery reference to the element.

public

enabled(state: boolean)

Enable or disable the DOM element.

Public Constructors

public constructor(id: string, onChange: function) source

Override:

DOMElement#constructor

Params:

NameTypeAttributeDescription
id string

HTML id of the input.

onChange function

Callback function for when input value changes.

Public Members

public default: number | string source

Default value for the input.

public isInvalid: boolean source

Flag for remembering if the input is invalid.

public isNumber: boolean source

Defines if the parsed value must be casted to a number, otherwise the input is invalid.

public onChange: function source

Callback function for when the input value changes.

public onFocusout: function source

Callback function for when the focus is lost.

public value: number | string source

Stores the parsed value of the input.

Public Methods

public invalid(state: *) source

Params:

NameTypeAttributeDescription
state *

public set(value: *) source

Params:

NameTypeAttributeDescription
value *