Is there a float input type in HTML5?

前端 未结 9 1797
失恋的感觉
失恋的感觉 2020-11-22 11:32

According to html5.org, the \"number\" input type\'s \"value attribute, if specified and not empty, must have a value that is a valid floating point number.\"

Yet it

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 12:30

    
    

    This worked for me and i think is the easiest way to make the input field accept any decimal number irrespective of how long the decimal part is. Step attribute actually shows the input field how many decimal points should be accepted. E.g, step="0.01" will accept only two decimal points.

提交回复
热议问题