title: Validate key input in field with javascript
body: <p>I am using</p>
  
  <pre><code>document.getElementById('input-field').addEventListener('keyup', function (e) {
    if (!String.fromCharCode(e.which).match(/[A-Za-z0-9,]/)) {
      event.preventDefault();
    }
  });
  </code></pre>
  
  <p>It almost works. The problem is that I cannot use key arrows, backspace, delete, ctrl+a, etc.</p>
  
  <p>How can I limit it to only those keys that will give a string representation in the specific input?</p>