fix empty input

This commit is contained in:
Jakob Ketterl 2021-02-27 22:43:18 +01:00
parent 71acad3b4f
commit e787336fc4

View File

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