Fork me on GitHub

input 输入框只能输入数字,一行代码解决,兼容谷歌 火狐

 

<input id="mobile" name="mobile" type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" class="input" placeholder="请填电话或手机号码"  />

 

posted @ 2018-11-01 14:50  youxiu326  阅读(339)  评论(0编辑  收藏  举报