正文html:input的type=number的时候maxlength失效问题IP云V管理员/2022-11-25/5 阅读 11/25提示:扫一扫查出行【扫一扫了解最新限行尾号】复制提示 <input type="text" maxlength="5" /> 效果ok,当 <input type="number" maxlength="5" />时maxlength失效,长度可以无限输入。 解放方案: <input type="number" oninput="if(value.length>5)value=value.slice(0,5)" /> 很简单,搞定!