设置input框的值为必填数字

<input type='text' onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();" />

简简单单一行代码搞定

posted @ 2022-04-24 10:34  沫栀  阅读(461)  评论(0)    收藏  举报