-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
101 lines (97 loc) · 3.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
$(document).ready(function(){
var n = $(".numberTextBox").inputNumericTextBox({
negativeAllow: false,
decimalAllow: true,
maxDecimalDigits: 4,
maxValue: 800,
minValue: 300,
beforeKeypressAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('before keypress');
},
afterKeypressAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('after keypress');
},
beforeKeyupAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('before keyup');
},
afterKeyupAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('after keyup');
},
beforeBlurAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('before blur');
},
afterBlurAction: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('after blur');
},
onError: function(evt, settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('on error');
if (settings.decimalError) {
//alert('More than one decimal number is not allowed');
} else if (settings.multipleNegativeSignError) {
// alert('More than one negative sign is not allowed.');
} else if (settings.startNegativeSignError) {
//alert('You can only use one negative sign at the start');
} else if (settings.maxDecimalDigitError) {
//alert('You can only use ' + settings.maxDecimalDigits + ' decimal digits.');
} else if (settings.maxValueError) {
//alert('You cann\'t enter value more than ' + settings.maxValue);
}
},
onInitializationStart: function(settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('on complete');
},
onInitializationComplete: function(settings) {
//console.log(this);
//console.log(evt);
//console.log(settings);
//console.log('on complete');
}
});
//$(n).trigger("increment", 210);
setTimeout(function(){
$(n).trigger("setMaxValue", 1010);
}, 3000); // 3 seconds
$(n).on('onError', function(evt, settings){
//console.log(evt);
//console.log(settings);
});
/**
* Important Note
* ==============
* If you initialize more than one then it will override previous settings and events.
* To maintain previous events, pass the whole setting once again with changes within it.
* Now it will override events
*
* Example of more than one initialization:
* $(".numberTextBox").inputNumericTextBox();
* var n = $(".numberTextBox").inputNumericTextBox({
* negativeAllow: false,
* decimalAllow: true
* });
* console.log(n);
*/
});