input number maxlength chrome
上面这个html代码,其实是想限定number的值为小数点后一位,但其实没有实现。在Chrome中这个maxlength会被忽略掉,在IE 11和Edge中最多只能输到小数点(例如1.2)。
正确的做法是用 step
Chrome中的 input number 的 maxlength 会被忽略,其实忽略掉是对的。
MDN input maxlength
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-maxlength
Is there a float input type in HTML5?
https://stackoverflow.com/questions/19011861/is-there-a-float-input-type-in-html5