jQuery input框只允许输入数字
1、只允许输入数字
<input type="text" onkeyup="value=value.replace(/[^\d]/g,'')" />
2、允许输入数字和特殊字符
//逗号后填写允许的特殊字符,如:
<input type="text" onkeyup="value=value.replace(/[^\0-9,*&#]/g,'')" />
3、不允许输入中文,但允许输入英文
<input type="text"onkeyup="value=value.replace(/[\W]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />