HTML5 input box with type=quot;numberquot; does not accept comma in Chrome browser(类型=“数字的 HTML5 输入框Chrome 浏览器不接受逗号)
问题描述
我正在使用带有 type="number"
的 HTML5 输入框.关于某些文档,如果我也使用 lang=""
属性,应该可以输入带逗号(不带句点)的数字.它适用于 Firefox,但不适用于 Chrome(不接受逗号).如何让 Chrome 接受输入框中的逗号.我的问题是我们的德国用户希望他们可以在此处输入逗号而不是句点.
I am using a HTML5 input box with type="number"
. Regarding to some documentations, it should be possible to enter a number with comma (not with period) if I also use the lang=""
attribute. It is working in Firefox, but not in Chrome (does not accept a comma). How can I get Chrome to accept the comma in the input box.
My problem is that our German users expect that they can enter a comma instead of a period there.
https://jsfiddle.net/byte2702/y3Lpfw7m/
Please enter a number with comma: <br/>
<input id="num" type="number" step="any" lang="de" pattern="-?[0-9]+[,.]*[0-9]+" />
推荐答案
截至目前(30/08/2017),Antoine Thiry 的回答在 Chrome 中似乎不再有效(我的版本是 60.0.3112.113).不幸的是,除了用 javascript 模拟 type="number" 之外,我没有任何其他建议.
As of now (30/08/2017), Antoine Thiry's answer seems to be no longer valid in Chrome (my version is 60.0.3112.113). Unfortunately I don't have any other suggestion, other than simulating type="number" with javascript.
这篇关于类型=“数字"的 HTML5 输入框Chrome 浏览器不接受逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:类型=“数字"的 HTML5 输入框Chrome 浏览器不接受逗号


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 400或500级别的HTTP响应 2022-01-01