OnChange event does not fire when barcode scanner result is returned to a text box

Richard 2 years ago in Application • updated 2 years ago 1

We inject the following JavaScript after a barcode scan:


However jQuery will not detect this as a value change (happens when tested on Chrome too).

Instead we call the "onchange" function of the input field, for example your page would contain the below:

<a href="#" onclick="javascript:openAndroidBarcodeScannerInput('testinput');">Open Barcode Scanner - input field ID * Requires 2.0.7 or higher</a>
<input type="text" id="testinput" value="" onchange="onTestInputChange()">
      function onTestInputChange() {
        alert('.change() for testinput, value = ' + $('#testinput').val());

Kiosk Browser then injects the following code after a successful barcode scan.

if (document.getElementById('testinput').onchange != null) {

You can test this via our sample JavaScript page http://www.android-kiosk.com/jstest.htm