设置input不能输入空格

版权声明:转载请@我原创地址 https://blog.csdn.net/weixin_39706415/article/details/83991994
   <input class="common-text required" id="imageUrl" name="title" size="50" value=""
                                   type="text" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入图片地址">

 核心

onkeyup="this.value=this.value.replace(/\s+/g,'')"

猜你喜欢

转载自blog.csdn.net/weixin_39706415/article/details/83991994