input el-input 只能输入正整数验证

字母e在js中属于数字,所以一般的正则匹配 \d 是拦不住字母e 的

正确写法为:

onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"

技术分享图片

 

文章来自:https://www.cnblogs.com/fmixue/p/10957038.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3