input type=number 时maxlength无效,且 只能输入正整数时

     val = val.slice(0, 5);
     val = val.replace(/[^0-9]/gi, "");
原文地址:https://www.cnblogs.com/dianzan/p/14272500.html