thousandwithdot

by bvotcode

HTML

<form>
<label for="ticketNum">Your  money</label>
<input type="text" oninput="sepratornumberwithdot(this)"  placeholder="123.456.789"/>
</form>

JavaScript

function sepratornumberwithdot(input) {
let nums = input.value.replace(/[,\.]/g, '');

  if (!nums || nums.endsWith('.')) return;
  input.value = parseFloat(nums).toLocaleString().replace(/,/g, '.');
}