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