Skip to content
Advertisement

how to insert data into select2 search input after scan using qrcode

image

Example results that i want :

enter image description here

I already did the qrcode scan and select2. It is working fine. The problem is I want that data “SBD2P3000002” to be searched in the select2 dropdown. Already tried with the input tag and its working, but with the select2 dropdown, it is not working.

here my code :

JavaScript

Advertisement

Answer

have you initilized the select2? i dont see that in your coding…

JavaScript

to be sure your DOM is loaded, encapsulate your script inside this function

JavaScript

to put a value (which exists) in search box, you have to write:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement