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

84
Visualizações
Javascript input text onchange by other script

Been searching a way to detect real time change on the input but not changed by user which is changed by also a code

Example: QR Scanned(not my code lib. only) > text output will go to certain text input > when text changed it throws an alert and nothing will happen if there's no scanned or the value is recent scanned.

My current progress to that code is pasted below, it is not working unless it was change by user qr text output is working but alert not working since it will no get triggered by the "change".

  $("#UUID").on("change", function(e) {
    var UUID = document.getElementById("UUID").value;
    if ("SCANNING" != UUID) {
        alert(UUID);
    }

  });

the idle value of text input is "SCANNING" thats why i left the if else statement != "SCANNING" so it will throw alerts when not getting scan by other output/value. Hoping to get help in not throwing alerts to when scanning the same value so it won't spam alerts.

Here's a video demo of the scanner via Imgur

  • https://i.imgur.com/UlFMsPz.mp4
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I finally solved it, I was looking for the functionality of throwing the text value of qr text output and created a global variable and added a call function line in the end of the qr text output then send the variable of it to the internal js.

So here's the code line i modified from the QR scanner:

var ScannedUUID; //created global variable
function read(a)
{
    var html="<br>";
    if(a.indexOf("http://") === 0 || a.indexOf("https://") === 0)
        html+="<a target='_blank' href='"+a+"'>"+a+"</a><br>";
    html+="<b>"+htmlEntities(a)+"</b><br><br>";
    document.getElementById("result").innerHTML=html;
    document.getElementById("UUID").value= a;
    ScannedUUID; = a; //set the qr text out value to global
    scannedTransfer(); //call the function from the index.html      
}   

Here's the index.html:

<script type="text/javascript" src="./webqr.js"></script>
<script>
  function scannedTransfer(){
    //so created a local variable for new variable of out global
    var UUID = ScannedUUID;
    //added some output for testing
    console.log("Working, Scanned: " + UUID)
    alert(UUID);
  }
</script>
about 4 years ago · Juan Pablo Isaza Relatório
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