版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24122593/article/details/86299209
input在标签内设置禁止输入空格
1.通过正则匹配解决问题
此处涉及\s:匹配任意空白符 \S:匹配任意非空白字符
<input type="text" onkeyup="this.value=this.value.replace(/\s+/g,'')">
input在标签内设置禁止输入空格
1.通过正则匹配解决问题
此处涉及\s:匹配任意空白符 \S:匹配任意非空白字符
<input type="text" onkeyup="this.value=this.value.replace(/\s+/g,'')">