0

I have a very simple Yii2 input field where I will enter data from a keyboard or from a barcode scanner.

I need to know how to detect if the device used is the keyboard or the barcode scanner.

Maybe I will use a jQuery plugin that can detect it.

Roby Sottini
  • 2,117
  • 6
  • 48
  • 88

1 Answers1

2

with javascript, You can use a "onkeyup" event on the input box. If the event has triggered then you can consider as input from keyboard

or you can try this jQuery plugin https://plugins.jquery.com/scannerdetection/

Azraar Azward
  • 1,586
  • 2
  • 12
  • 16