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:
Bernd Bestel 2021-03-31 22:26:27 +02:00
parent 791a17fcad
commit d23fda245e
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 4 additions and 3 deletions

View File

@ -21,8 +21,9 @@
### Userfield fixes
- Fixed that numeric Userfields were initialised with `1.0`
### General & other improvements
### General & other improvements/fixes
- Some night mode style improvements (thanks @BlizzWave and @KTibow)
- Fixed that the number picker up/down buttons did not work when the input field was empty or contained an invalid number
### API fixes
- Fixed that due soon products with `due_type` = "Expiration date" were missing in `due_products` of the `/stock/volatile` endpoint

View File

@ -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');
});