javascript - HTML text input allow only numeric input - Stack Overflow

PHOTO EMBED

Thu Aug 01 2024 17:23:40 GMT+0000 (Coordinated Universal Time)

Saved by @webmaster30 #html

<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1').replace(/^0[^.]/, '0');" />
content_copyCOPY

https://stackoverflow.com/questions/469357/html-text-input-allow-only-numeric-input