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

178
Visualizações
onEvent inside of a loop - Javascript

I've been trying to run this loop with onEvents inside of it, but it doesn't seem to work. I can click the button and everything works, the inner while loop keeps repeating until an onEvent is triggered, but none of the onEvents get triggered when I click on them.

onEvent("startBtn", "click", function() {
  setScreen("songScreen");
  setText("songName1", "Song name: " + trackName[0]);
  setText("artistName1", "Artist name: " + artistName[0]);
  setText("pos1", "Song position: " + songPos[0]);
  setText("pop1", "Song popularity: " + songPop[0]);
  while (i < songPos.length) {
    setText("songName1", "Song name: " + trackName[i]);
    setText("artistName1", "Artist name: " + artistName[i]);
    setText("pos1", "Song position: " + songPos[i]);
    setText("pop1", "Song popularity: " + songPop[i]);
    upClick();
    downClick();

  }

});

function upClick() {
  onEvent("upImg", "click", function() {
    songLiked = true;
    console.log("test up");
    i++;
  });
}

function downClick() {
  onEvent("downImg", "click", function() {
    songLiked = false;
    console.log("test down");
    i++;
  });
}

What am i doing wrong?

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