只能输入数字
<input onkeyup=”value=value.replace(/[^\d]/g,”)” onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^\d]/g,”))”>
只能输入数字和英文
<input type=”text” onkeyup=”value=value.replace(/[\W]/g,”) “onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^\d]/g,”))” />
欢迎分享本文,转载请保留出处:前端ABC » input输入框过滤