disable paste space in textbox using javascript
snippet in javascript

disable paste space in textbox using javascript

user5876

// don't allow paster space from another source
restrict_allow_paste_space: function($ele){
  $ele.on('keypress', function(e) {
    if (e.which == 32){
      return false;
    }
  });
  $ele.on('paste', function(e) {
    e.preventDefault();
  });
},
  
  
// don't allow space when type username
<input type="search" name="username" id="login-username" class="form-control a4l-input"  onKeyDown="if(event.keyCode === 32) return false;" placeholder="<?php echo  __d('member', 'enter_usename')?>">