如何将小数逗号替换为<输入类型=“;数字“>

How to replace the decimal comma to a point in <input type="number">?

本文关键字:类型 输入 gt 数字 lt 替换 小数      更新时间:2023-09-26

这不起作用:

<input id="input" type="number" value = "10.5">
var input = document.getElementById("input");
input.value = input.value.replace(/,/, ".");

https://jsfiddle.net/ky6h0tpf/3/

这个答案将显示一个十进制而不是逗号。

https://jsfiddle.net/ky6h0tpf/10/

<input id="input" type="number" value = "10.5">

这可能是浏览器区域设置的问题。