javascript - 如何将小数逗号替换为<input type ="number">中的一个点?

标签 javascript html google-chrome

这不起作用:

<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">

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

关于javascript - 如何将小数逗号替换为&lt;input type ="number">中的一个点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34159630/

相关文章:

javascript - 并非所有 CSS 都在 Vuetify 中与 Vue.js 和 Webpack 一起运行

javascript - Chrome 应用程序中的按钮不起作用

javascript - location.hash = window.location.hash 在 Chrome 中不起作用

javascript - 意外标记 } 在 html 标记

php - 根据表格的特定行指定颜色。情况

html - 将div数据转换为word文档时绑定(bind)样式表和HTML div

css - 奇怪的 Chrome 问题

javascript - 编写正则表达式过滤器来解析以反向时间戳顺序存储的一系列日期

javascript - 为什么嵌套的 describe() block 看不到外部 block 中定义的变量?

javascript - 随机显示配对元素