![](/img/trans.png)
[英]Decimal / Thousand separator (dot and comma) in the calculation results Js and Input field
[英]How to validate input for comma as decimal separator using JS?
我目前正在使用它来允许用户输入数字,但是它接受多个点和逗号,我很想将其限制为更精确的数字输入,因为上帝知道用户可以做的奇迹。
如何将其限制为逗号作为小数分隔符?
<input oninput="this.value=this.value.replace(/[^0-9.,]+/gmi,'')" value="">
提前致谢!
试试下面的代码:
<input onChange="this.value=this.value.replace(/[^A-Z0-9]+/ig, '')" value="">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.