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
I had the same problem and based on the idea with the event listener I build custom solutions for IE/Chrome and Firefox:
IE + Chrome (Raidox solution):
document.getElementById('scanfield').addEventListener('keypress', function(e) {
if (e.which === 29) {
this.value += String.fromCharCode(e.which);
}
});
Firefox:
var altValue = '';
document.getElementById('scanfield').addEventListener('keypress', function(e) {
if(e.altKey){
altValue += String.fromCharCode(e.which)
if(altValue == '0029'){
this.value += String.fromCharCode(29);
altValue='';
}
}
});
Edge works out of the box.