onkeyup="this.value=this.value.replace(/\D|^0/g,'')" onafterpaste="this.value=this.value.replace(/\D|^0/g,'')"
转载于:https://www.cnblogs.com/douglasvegas/p/7283781.html
本文探讨了如何使用onkeyup和onafterpaste事件结合正则表达式限制输入框的内容,确保只允许数字输入,同时移除任何前导零。
onkeyup="this.value=this.value.replace(/\D|^0/g,'')" onafterpaste="this.value=this.value.replace(/\D|^0/g,'')"
转载于:https://www.cnblogs.com/douglasvegas/p/7283781.html
940
1万+
2874

被折叠的 条评论
为什么被折叠?