我的input标签的类型是text,需要在里面只能输入数字,而且最大是10,不用正则表达式,要怎么实现
我觉得还是正则好多了。
<input type="number" name="points" min="1" max="10" />
参考:http://www.w3school.com.cn/tiy/t.asp?f=html5_form_number
2015年12月24日 14:00:28 更新
<input type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength = 1>
收工。