input只能输入数字0-9(不含小数点)

<input type="text" placeholder="数量" class="addTell" id="robotCount" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');">
正则验证方法判断是否输入的是0-9,不然置为空(适应于只能输入int类型)

猜你喜欢

转载自blog.csdn.net/yufengaotian/article/details/80916269
今日推荐