html input标签 要求只能输入纯数字

使用这个即可:oninput = "value=value.replace(/[^\d]/g,'')"


具体应用:

 <input type="text" name="tel" oninput = "value=value.replace(/[^\d]/g,'')" maxlength="11"/>

猜你喜欢

转载自blog.csdn.net/weixin_34234721/article/details/87069623