Force decimal point instead of comma in HTML5 number input (client-side)

后端 未结 15 749
情话喂你
情话喂你 2020-11-29 03:05

I have seen that some browsers localize the input type=\"number\" notation of numbers.

So now, in fields where my application displays longitude and la

15条回答
  •  半阙折子戏
    2020-11-29 03:50

    With the step attribute specified to the precision of the decimals you want, and the lang attribute [which is set to a locale that formats decimals with period], your html5 numeric input will accept decimals. eg. to take values like 10.56; i mean 2 decimal place numbers, do this:

    
    

    You can further specify the max attribute for the maximum allowable value.

    Edit Add a lang attribute to the input element with a locale value that formats decimals with point instead of comma

提交回复
热议问题