Search code examples
javascriptc#model-view-controllerwebcam

Grab certain text as soon as it appears - Javascript?


I have an app which scans a QR Code from a webcam. Now this scanner gets it from a live feed, no capture image. This in a way is great for what i want, less human interaction, however it has presented a problem for me.

When the QR Code is scanned it is presents the URL/text in a textbox but as soon as i removed the QR code from the webcam the text disappears.

Is there anyway of grabbing the text from the textbox depending on what it is? i want it to be pulled if the QR code text has "Job x" in it. Any ideas to get that text before i remove the qr code from the webcam?


Solution

  • Are you just asking how to add a change-handler to an ?

    document.getElementById('myInput').onchange = function() {
        console.log(this.value);
    };
    

    This assumes that the code responsible for setting your text is triggered an onchange event. (It won't happen by default unless the field receives focus/blur.)