zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.
https://zxing-js.github.io/library/
Apache License 2.0
2.47k stars 546 forks source link

Trigger the barcode scanning by clicking on a text field #487

Open leewesley123 opened 2 years ago

leewesley123 commented 2 years ago

Hello everyone! :)

I am working on a mobile web app that requires when user will click on a text field, it will trigger the barcode scanning.

May I know how can I do that using the zxing library? I am able to make it work when after scanning the barcode it populates the results into another text field. But how can I do such that by clicking on a text field it will trigger the scan?

Thanks in advance! :)

Regards, Lee

mircerlancerous commented 2 years ago

The 'live demo' gives you pretty much all the information you'll need. Just take that example and adjust it to your app. Remove the button from the sample that triggers the scan, and trigger it instead with a onclick eventhandler on your text field. If you still can't make it work, you will be better off asking your question on Stackoverflow

github-actions[bot] commented 5 months ago

Stale issue message