jQuery EasyUI Form Plugin - Numberbox Numeric Input
Extends from $.fn.validatebox.defaults. Overrides the default defaults with $.fn.numberbox.defaults.
The numberbox is used to allow users to input numeric values only. It can transform the input element into different types of inputs (such as numeric, percentage, currency, etc.). More input types depend on the 'formatter' and 'parser' functions to define.
Dependencies
- validatebox
Usage
Create a numberbox from markup.
<input type="text" class="easyui-numberbox" value="100" data-options="min:0,precision:2">
Create a numberbox using JavaScript.
<input type="text" id="nn">
$('#nn').numberbox({
min:0,
precision:2
});
Properties
The properties extend from validatebox, and the following are the additional properties for numberbox.
Name | Type | Description | Default Value |
---|---|---|---|
disabled | boolean | Defines if the field is disabled. | false |
value | number | The default value. | |
min | number | The minimum allowed value. | null |
max | number | The maximum allowed value. | null |
precision | number | The maximum precision to display after the decimal point. | 0 |
decimalSeparator | string | The character used to separate the integer part and the decimal part of the number. | . |
groupSeparator | string | The character used to separate groups of integers. | |
prefix | string | The prefix string. | |
suffix | string | The suffix string. | |
filter | function(e) | Defines how to filter the key pressed, return true to accept the input character. This property is available since version 1.3.3. | |
formatter | function(value) | The function used to format the numberbox value. Returns the string value displayed in the box. | |
parser | function(s) | The function used to parse the string. Returns the numberbox value. |
Events
Name | Parameters | Description |
---|---|---|
onChange | newValue,oldValue | Triggered when the field value changes. |
Methods
The methods extend from validatebox, and the following are the additional or overridden methods for numberbox.
Name | Parameters | Description |
---|---|---|
options | none | Returns the options object. |
destroy | none | Destroys the numberbox object. |
disable | none | Disables the field. |
enable | none | Enables the field. |
fix | none | Fixes the value to a valid value. |
setValue | none | Sets the value of the numberbox. <br>Example: $('#nn').numberbox('setValue', 206.12); |
getValue | none | Gets the value of the numberbox. <br>Example: var v = $('#nn').numberbox('getValue');<br>alert(v); |
clear | none | Clears the value of the numberbox. |
reset | none | Resets the value of the numberbox. This method is available since version 1.3.2. |