input不允许输入空格 Aug 27 2018 当你没有使用验证插件,但需要禁止用户输入空格内容时候,你可以这样:<input type="text" onkeyup="this.value=this.value.replace(/\s+/g,'')">