title: JS - Disable Eventlistener once input field is selected
body: <p>I'm currently adding a EventListener to my document. Which works great using the following code:</p>
  
  <pre><code>document.addEventListener('keydown', function(event) 
  {
      if(event.keyCode === 68){
          socket.emit('keyPress', {inputId: 'right', state: true});
      }
      else if(event.keyCode === 83){
          socket.emit('keyPress', {inputId: 'down', state: true});
      }
      else if(event.keyCode === 65){
          socket.emit('keyPress', {inputId: 'left', state: true});
      }
      else if(event.keyCode === 87){
          socket.emit('keyPress', {inputId: 'up', state: true});
      }
  });
  
  document.addEventListener('keyup', function(event) 
  {
      if(event.keyCode === 68){
          socket.emit('keyPress', {inputId: 'right', state: false});
      }
      else if(event.keyCode === 83){
          socket.emit('keyPress', {inputId: 'down', state: false});
      }
      else if(event.keyCode === 65){
          socket.emit('keyPress', {inputId: 'left', state: false});
      }
      else if(event.keyCode === 87){
          socket.emit('keyPress', {inputId: 'up', state: false});
      }
  });
  </code></pre>
  
  <p>But once I would select a input field and type something containing W, A, S, D then the EventListener would be triggered.</p>
  
  <p>Is there a way to disable the eventListener once the input field is selected?</p>