HTML5 input box with type=“number” does not accept comma in Chrome browser

雨燕双飞 提交于 2019-11-27 14:04:40

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.

actually, if i read the documentation correctly, pattern is not supported for type=number. hence, stick to type=text and then add pattern="..." for the front end validation. in the next step, you will then need to convert the text input into a real number if it wasn't compatible to JavaScript/computing format.

2017 and still no good solution for this common problem...

As for now, I have tried

    <html lang="en">

or

    <input type="number" lang="en">

and it let me to input any: comma or period. I have tested it on desktop Ubuntu and mobile Android in Firefox and Chrome.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!