Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Internet Explorer and floating point numerical inputs #6012
I am working on a project where I need German users with IE8 through 10 to input floating point numbers in sliders. The decimal separator for German is "," not ".". In Chrome and Firefox I can input something like "5,5" and it will work as intended. In IE, no such luck, the comma gets deleted.
From my perspective this looks to be a compatibility issue, because the widget in IE doesn't accept the same input as other browsers do.
I don't have a good solution for this yet. I solved it by monkey patching window.parseFloat to replace commas with decimal points. That doesn't solve the display issue, because now the input displays a point-separated decimal.
I tested on Dutch Win7/IE10: http://jsbin.com/ulexaz/16. In NL we also use comma instead of point.
If you look at the native number input IE shows the value with a decimal point, while Chrome and Firefox show a comma here. So the problem starts with lack of i18n in IE.
Generally jquery-mobile does not have a framework for internationalization. Probably it shouldn't. But it should provide the necessary hooks. Some developers require Internationalization server-side, some client-side.
I haven't got a perfect solution for the problem. I don't believe it's possible to use the type="number" input without running into this issue, as the browser handles the input formatting on its own. I also tried using Chrome on Nexus 7, and there I have a decimal point, too despite an otherwise completely localized interface.
So maybe the best solution will be to provide a fallback using a string input for now.