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

后端 未结 15 707
情话喂你
情话喂你 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:35

    As far as I understand it, the HTML5 input type="number always returns input.value as a string.

    Apparently, input.valueAsNumber returns the current value as a floating point number. You could use this to return a value you want.

    See http://diveintohtml5.info/forms.html#type-number

提交回复
热议问题