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