使用这个即可:oninput = "value=value.replace(/[^\d]/g,'')"
具体应用:
<input type="text" name="tel" oninput = "value=value.replace(/[^\d]/g,'')" maxlength="11"/>
使用这个即可:oninput = "value=value.replace(/[^\d]/g,'')"
<input type="text" name="tel" oninput = "value=value.replace(/[^\d]/g,'')" maxlength="11"/>
本文标题:html input标签 要求只能输入纯数字
本文链接:https://www.haomeiwen.com/subject/cfjykqtx.html
网友评论