<html>
<body>
<input type="text" keyup="_onSearchKeyUp">
</body>
</html>
I'm trying to get an input box to display numbers with space separator. Like this: 1234567891 and 123 456 789 10(every 3 symbols).
Im wrote this code:
_onSearchKeyUp: function (event) {
let value = this._getValue();
var parts = value.split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
this.$input.val(parts.join("."));
But this is not a good solution to the problem. Because of the value change, i'm always end up with the marker at the end, So it is e.g. impossible to use arrow keys to navigate back or just edit in the middle of the input.
How i can fix this problem?