Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
Cómo insertar datos en select2 después de escanear el CÓDIGO QR en php usando javascript

He intentado varias soluciones de un problema similar, pero no funciona en mi programa. Quiero que el código del libro en el código qr aparezca en la búsqueda select2 cuando se escanee. Esto funciona cuando se usan etiquetas de entrada, pero no funciona cuando se usa select2.

Este es mi código a continuación:

 <script type="text/javascript"> let scanner = new Instascan.Scanner({ video: document.getElementById('preview') }); startWebcam = function() { Instascan.Camera.getCameras().then(function(cameras) { if (cameras.length > 0) { scanner.start(cameras[0]); } else { console.error('No Cameras Found'); } }).catch(function(e) { console.error(e); }); //its not working scanner.addListener('scan', function(content) { // alert(content); // $("#qrcode").val(content); $('#qrcode').select2(); $("#qrcode").val("content").trigger("change"); }); } stopWebcam = function() { scanner.stop(); } </script>
 <select id="qrcode" style="width: 100%;" name="id_buku" class="form-control select2" required> <option value="">-- Silahkan Pilih Buku --</option> <?php foreach ($buku as $b) { ?> <option value="<?= $b['id']; ?>"><?= $b['no_inven'] . ' - ' . $b['judul']; ?></option> <?php } ?> </select>

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!