USSliberty USSliberty - 7 months ago 80
Javascript Question

Remove leading zeros from input type=number

I noticed that if i use the leading zeros are not removed. I also saw a lot of discussion on how keeping leading zeros.

For example "000023" and "23" are the same number and i think that it doesn't make sense keeping those zeros.


just use a regular expression like this

textboxText= textboxText.replace(/^0+/, '')