Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda