mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 18:26:00 +00:00
Fixed that the number picker up/down buttons did not work when the input field was empty or contained an invalid number
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
$(".numberpicker-down-button").unbind('click').on("click", function()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||
inputElement.val(parseFloat(inputElement.val()) - 1);
|
||||
inputElement.val(parseFloat(inputElement.val() || 1) - 1);
|
||||
inputElement.trigger('keyup');
|
||||
inputElement.trigger('change');
|
||||
});
|
||||
@@ -9,7 +9,7 @@ $(".numberpicker-down-button").unbind('click').on("click", function()
|
||||
$(".numberpicker-up-button").unbind('click').on("click", function()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||
inputElement.val(parseFloat(inputElement.val()) + 1);
|
||||
inputElement.val(parseFloat(inputElement.val() || 0) + 1);
|
||||
inputElement.trigger('keyup');
|
||||
inputElement.trigger('change');
|
||||
});
|
||||
|
Reference in New Issue
Block a user