正则表达式
只能输入纯数字onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" ;onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"
onkeyup="this.value=this.value.replace(/\D/g,'')";
onafterpaste="this.value=this.value.replace(/\D/g,'')";
只能输入中文
开头不能为0,不能有小数点
onkeyup="this.value=this.value.replace(/\D|^0/g,'')" onafterpaste="this.value=this.value.replace(/\D|^0/g,'')"
开头不能为0
<div class="input-choseNum">
<input type="number" id="inp-chooseNum" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' maxlength="5" />
<span class="sureChoose">确定</span><span class="closeChoose">取消</span>
</div>