![](/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.