Good morning,
I would like to use JavaScript to manipulate a number input field so that if only one decimal place is entered, a zero is added, and if no decimal place is given, even two.
Now I have tried the following:
///html
<input type="number" id="netpricePerSeat" name="netpricePerSeat" placeholder="0,00" step=".01" min="2.5" onchange="endingZeros(this)" onkeyup="endingZeros(this)" onclick="endingZeros(this)" pattern="[0-9]+([\,|\.][0-9]+)?">
///js
  function endingZeros(input) {
    var countDecimals = function(value) {
      if (Math.floor(value) !== value)
        if(value.toString().includes('.'))
          return value.toString().split(".")[1].length || 0;
        if(value.toString().includes(','))
          return value.toString().split(",")[1].length || 0;
      return 0;
    }
    if(!isNaN(input.value) && countDecimals(input) === 1) {
      input.value = input.value + '0';
    }
  }
Unfortunately it is not clear at all. Important, in the field you should be able to enter decimal with comma or dot, because the form should be for all countries
