Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
JQuery/JS "type" in a variable rather than changing the value

I have implemented a barcode scanner which uses mobile cameras to decode and populate a search field . This field has autocomplete function while typing:

For example: database has - 1234, 938, 18279, 3920, 5781

If I type in the search bar "18" it will automatically select 18279 as there are no other options in database

This usually works regularly with barcode scanners (hardware) as they are acting as an input.

However when I use this html5/js based barcode scanner, it is decoding the result and pasting them in the search box however the autocomplete/search function is not working.

This is my code

function onScanSuccess(decodedText, decodedResult) {
    if (decodedText !== lastResult) {
        document.getElementById("search_product").value = ''; 
        beep();
        ++countResults;
        lastResult = decodedText;
        console.log(`Scan result ${decodedText}`, decodedResult);
        document.getElementById("search_product").focus();
        document.getElementById("search_product").value = decodedText;
    }
}

I think the issue is with .value as it is changing the field value rather than "inputting" the result. Are there any alternatives to .value which might solve my issue?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda