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

后端 未结 5 2059
逝去的感伤
逝去的感伤 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:14

    You guys are completely right numbers can only go in the numeric field. I use the exact same thing as already listed with a bit of css styling on a span tag:

    $
    

    Then add a bit of styling magic:

    span{
      position:relative;
      margin-right:-20px
    }
    input[type='number']{
      padding-left:20px;
      text-align:left;
    }
    

提交回复
热议问题