Search code examples
javascriptbarcode-scanner

Onchange Doesn't Fire


I am told that onchange fires when the value changes. I have a text box with an onchange attached to it. Then set the focus to the text box. When I scan a barcode thereby changing the textbox value onchange does not fire? I need to call a function when the scanner activates.


Solution

  • onchange is primarily used to Select box

    Use onKeyPress or onKeyUp for text box.

    Edit: with Barcode scanner you might have to trigger an onFocus or onblur