I\'m trying to process input from a barcode scanner in a javascript browser app. The scanner output is a string of characters, which also contains at least one Group Separator c
The input control ignores non printable characters like [GS]
However, a barcode scanner usually emulates this character with CTRL+], which can be captured with the onkeydown event (key codes 17 and 221):
var ctrlPressed = false;
yourInput.addEventListener('onkeydown', function (event) {
ctrlPressed = 17 === event.keyCode;
if (221 === event.keyCode && ctrlPressed)
// do what you want here (ie. modify the input value)
});
If this does not work you may want to check the codes first by logging them:
yourInput.addEventListener('onkeydown', function (event) {
console.log(event.keyCode)
});