jdarwood007 commited on 2021-07-10 11:57:25
Showing 1 changed files, with 9 additions and 4 deletions.
... | ... |
@@ -27,23 +27,24 @@ |
27 | 27 |
}(function ($) { |
28 | 28 |
'use strict' |
29 | 29 |
$.fn.numbercontrol = function (methodOrProps) { |
30 |
- if (methodOrProps === 'destory') { |
|
30 |
+ if (methodOrProps === 'destory' || (typeof methodOrProps === 'object' && methodOrProps.destroy !== undefined)) { |
|
31 | 31 |
this.each(function () { |
32 | 32 |
$(this).parent().children().each(function (index, value) { |
33 | 33 |
var thisSelector = $(value); |
34 | 34 |
|
35 |
- if (options.onBeforeDestoryInitialize !== undefined) |
|
35 |
+ if (typeof options === 'object' && options.onBeforeDestoryInitialize !== undefined) |
|
36 | 36 |
options.onBeforeDestoryInitialize(this); |
37 | 37 |
|
38 | 38 |
if (!thisSelector.is('input')) |
39 | 39 |
thisSelector.remove(); |
40 | 40 |
|
41 |
- if (options.onAfterDestoryInitialize !== undefined) |
|
41 |
+ if (typeof options === 'object' && options.onAfterDestoryInitialize !== undefined) |
|
42 | 42 |
options.onAfterDestoryInitialize(this); |
43 | 43 |
}); |
44 | 44 |
|
45 | 45 |
$(this).parent().removeClass().addClass('numberControlDestoryed'); |
46 |
- }) |
|
46 |
+ }); |
|
47 |
+ |
|
47 | 48 |
return this; |
48 | 49 |
} |
49 | 50 |
|
... | ... |
@@ -77,6 +78,10 @@ |
77 | 78 |
if (options.onBeforeSetNewvalue !== undefined) |
78 | 79 |
options.onBeforeSetNewvalue(this, event, container, value); |
79 | 80 |
|
81 |
+ // The Min value was hit with nothing in the container, which could most likely be a blank string that was converted to a int. |
|
82 |
+ if (Number.MIN_VALUE == parseFloat(value) && $(container).val() == '') |
|
83 |
+ return false; |
|
84 |
+ |
|
80 | 85 |
if (options.type === 'number') |
81 | 86 |
$(container).val(parseInt(value)); |
82 | 87 |
else |
83 | 88 |