input框设置必填数字

<input type="number" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();">
posted @ 2018-07-25 16:58  爱冯果  阅读(2065)  评论(0编辑  收藏  举报