onkeyup="this.value=this.value.replace(/\s+/g,'')"
<input type='text' onkeyup="this.value=this.value.replace(/\s+/g,'')" />
onkeyup="this.value=this.value.replace(/\s+/g,'')"
<input type='text' onkeyup="this.value=this.value.replace(/\s+/g,'')" />