If you input is string X then this code below will do it. Just make sure it is in the onKeyPress event.
x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
If you input is string X then this code below will do it. Just make sure it is in the onKeyPress event.
x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")