$("#form-input").on({ keydown: function(e) { if (e.which === 32) return false; }, keyup: function(){ this.value = this.value.toLowerCase(); }, change: function() { this.value = this.value.replace(/\s/g, ""); } });
<input id="form-input" placeholder="Type some text here...">
input { border: 3px solid #9E9E9E; border-radius: 5px; height: 45px; width: 450px; font-size: 24px; color: #212121; margin: 25px 0px 0px 25px; padding: 15px; }