prevent space in input

i used this to get 'div' ID from user and preventing space

by Simplybj

HTML

<input type="text" id="DOMID" />

JavaScript

$('#DOMID').on('keydown', function(e) {
  if (e.which === 32) {
    return false;
  }
});