HTML5 Number Input - Always show 2 decimal places

后端 未结 15 2162
太阳男子
太阳男子 2020-11-28 05:43

Is there\'s any way to format an input[type=\'number\'] value to always show 2 decimal places?

Example: I want to see 0.00 instead of

15条回答
  •  青春惊慌失措
    2020-11-28 06:43

    Solved following the suggestions and adding a piece of jQuery to force the format on integers:

    parseFloat($(this).val()).toFixed(2)
    

提交回复
热议问题