I would like to implement a thousand space separator in a ReadOnly input type number, but when trying to do so, it doesn't seem to be working and I can only write 3 numbers, and then the whole thing disappears.
Code
<input
type="number"
onChange={props.onInputChange}
value={props.value ? props.value : 0}
min={props.min}
max={props.max}
readOnly="readonly"
/>
export const priceFormatterSpace = (price) => {
return price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
};
Any help?