fix empty input

This commit is contained in:
Jakob Ketterl 2021-02-27 22:43:18 +01:00
parent 71acad3b4f
commit e787336fc4
1 changed files with 5 additions and 2 deletions

View File

@ -30,7 +30,10 @@ $.fn.frequencyInput = function() {
$exponent.on('change', setExponent);
// calculate initial exponent
$exponent.val(Math.floor(Math.log10($input.val()) / 3) * 3);
setExponent();
var value = parseFloat($input.val());
if (!Number.isNaN(value)) {
$exponent.val(Math.floor(Math.log10(value) / 3) * 3);
setExponent();
}
})
};