Set value to currency in <input type=“number” />

后端 未结 5 2045
逝去的感伤
逝去的感伤 2020-12-01 01:35

I am trying to format a number input by the user into currency using javascript. This works fine on . However, on

5条回答
  •  醉梦人生
    2020-12-01 02:32

    The browser only allows numerical inputs when the type is set to "number". Details here.

    You can use the type="text" and filter out any other than numerical input using JavaScript like descripted here

提交回复
热议问题