您的位置:首页 > 移动开发

JS限制移动端与PC端只能只能输入数字

2018-02-01 10:50 295 查看
PC端

<input type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'') " name="phone" id="phone" value=""/>移动端
<input type="number" pattern="[0-9]*" id="phone" name="phone" value="">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: