oninput="this.value = this.value.replace(/[^-0-9.]/g, '')
I use this code in my project, but input also can get more than 1 minus signs like this:
---23
I want my input to have these conditions:
You can adjust your regex to below
EDIT.
Based on your requirements:
/^(-)?[0-9]*/g
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With